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 2023-01-19 06:31:17 +08:00
parent 48c8c1bf48
commit 89b0e25e2c
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
3 changed files with 7 additions and 3 deletions

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
lnutils/README.md Normal file
View File

@ -0,0 +1,4 @@
# `lnutils`
This package provides fundamental types and utility functions that can be used
by all other packages.

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.