multi: add lnutils to host fundamental utility functions

We also move the `fn/stream.go` into the package `lnutils`. Eventually
we will put all the [utility
functions](https://github.com/lightninglabs/taro/tree/main/chanutils)
into this package.
This commit is contained in:
yyforyongyu committed 2023-01-19 06:38:50 +08:00
1 parent 48c8c1bf48
commit 89b0e25e2c
3 files changed
+7 -3

No files matched your search

+2 -2
View File
@@ -18,10 +18,10 @@ import (
"github.com/lightningnetwork/lnd/batch"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/fn"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/kvdb"
"github.com/lightningnetwork/lnd/lnpeer"
"github.com/lightningnetwork/lnd/lnutils"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/multimutex"
@@ -1185,7 +1185,7 @@ func (d *AuthenticatedGossiper) sendBatch(annBatch []msgWithSenders,
// skip the filter and dedup logic below, and just send the
// announcements out to all our coonnected peers.
if isLocal {
msgsToSend := fn.Map(
msgsToSend := lnutils.Map(
annBatch, func(m msgWithSenders) lnwire.Message {
return m.msg
},
+4
View File
@@ -0,0 +1,4 @@
# `lnutils`
This package provides fundamental types and utility functions that can be used
by all other packages.
+1 -1
View File
@@ -1,4 +1,4 @@
package fn
package lnutils
// Map takes an input slice, and applies the function f to each element,
// yielding a new slice.