Merge pull request #4280 from cfromknecht/read-for-each-node

channeldb: remove Tx arg from ForEachNode
This commit is contained in:
Conner Fromknecht
2020-05-13 16:37:10 -07:00
committed by GitHub
5 changed files with 8 additions and 21 deletions

View File

@ -4599,7 +4599,7 @@ func (r *rpcServer) DescribeGraph(ctx context.Context,
// First iterate through all the known nodes (connected or unconnected
// within the graph), collating their current state into the RPC
// response.
err := graph.ForEachNode(nil, func(_ kvdb.ReadTx, node *channeldb.LightningNode) error {
err := graph.ForEachNode(func(_ kvdb.ReadTx, node *channeldb.LightningNode) error {
nodeAddrs := make([]*lnrpc.NodeAddress, 0)
for _, addr := range node.Addresses {
nodeAddr := &lnrpc.NodeAddress{
@ -4914,7 +4914,7 @@ func (r *rpcServer) GetNetworkInfo(ctx context.Context,
// network, tallying up the total number of nodes, and also gathering
// each node so we can measure the graph diameter and degree stats
// below.
if err := graph.ForEachNode(nil, func(tx kvdb.ReadTx, node *channeldb.LightningNode) error {
if err := graph.ForEachNode(func(tx kvdb.ReadTx, node *channeldb.LightningNode) error {
// Increment the total number of nodes with each iteration.
numNodes++