graph/db: let ForEachNode take a context

This commit is contained in:
Elle Mouton
2025-07-07 09:46:23 +02:00
parent f05ef2db97
commit 1e804a3d5f
8 changed files with 14 additions and 14 deletions

View File

@@ -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