mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-12 07:08:24 +01:00
graph/db: let ForEachNode take a context
This commit is contained in:
@@ -1447,7 +1447,7 @@ func TestGraphTraversalCacheable(t *testing.T) {
|
||||
// Create a map of all nodes with the iteration we know works (because
|
||||
// it is tested in another test).
|
||||
nodeMap := make(map[route.Vertex]struct{})
|
||||
err := graph.ForEachNode(func(tx NodeRTx) error {
|
||||
err := graph.ForEachNode(ctx, func(tx NodeRTx) error {
|
||||
nodeMap[tx.Node().PubKeyBytes] = struct{}{}
|
||||
|
||||
return nil
|
||||
@@ -1577,7 +1577,7 @@ func fillTestGraph(t testing.TB, graph *ChannelGraph, numNodes,
|
||||
|
||||
// Iterate over each node as returned by the graph, if all nodes are
|
||||
// reached, then the map created above should be empty.
|
||||
err := graph.ForEachNode(func(tx NodeRTx) error {
|
||||
err := graph.ForEachNode(ctx, func(tx NodeRTx) error {
|
||||
delete(nodeIndex, tx.Node().Alias)
|
||||
return nil
|
||||
})
|
||||
@@ -1689,7 +1689,7 @@ func assertNumChans(t *testing.T, graph *ChannelGraph, n int) {
|
||||
|
||||
func assertNumNodes(t *testing.T, graph *ChannelGraph, n int) {
|
||||
numNodes := 0
|
||||
err := graph.ForEachNode(func(tx NodeRTx) error {
|
||||
err := graph.ForEachNode(context.Background(), func(tx NodeRTx) error {
|
||||
numNodes++
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user