mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2025-12-17 22:24:21 +01:00
rpc: re-write GetNetworkInfo implementation to use single db transaction
This commit re-writes the GetNetworkInfo implenetaiton to use a single database transaction. We’re now able to do this due to the recent change in the API for the ChannelGraph struct and it’s related objects. The recent change allows the passed callback to accept a db transaction, with this, the callback is now able to issue another traversal routine _within_ the prior one.
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/lightningnetwork/lightning-onion"
|
||||
"github.com/lightningnetwork/lnd/brontide"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
@@ -340,8 +341,9 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = sourceNode.ForEachChannel(nil, func(_ *channeldb.ChannelEdgeInfo,
|
||||
policy *channeldb.ChannelEdgePolicy) error {
|
||||
err = sourceNode.ForEachChannel(nil, func(_ *bolt.Tx,
|
||||
_ *channeldb.ChannelEdgeInfo, policy *channeldb.ChannelEdgePolicy) error {
|
||||
|
||||
pubStr := string(policy.Node.PubKey.SerializeCompressed())
|
||||
|
||||
// Add addresses from channel graph/NodeAnnouncements to the
|
||||
|
||||
Reference in New Issue
Block a user