diff --git a/discovery/gossiper.go b/discovery/gossiper.go index 50834a632..70c1caf2e 100644 --- a/discovery/gossiper.go +++ b/discovery/gossiper.go @@ -1709,7 +1709,7 @@ func (d *AuthenticatedGossiper) retransmitStaleAnns(ctx context.Context, havePublicChannels bool edgesToUpdate []updateTuple ) - err := d.cfg.Graph.ForAllOutgoingChannels(func( + err := d.cfg.Graph.ForAllOutgoingChannels(ctx, func( info *models.ChannelEdgeInfo, edge *models.ChannelEdgePolicy) error { diff --git a/discovery/gossiper_test.go b/discovery/gossiper_test.go index a96ea0952..c10bdbbe1 100644 --- a/discovery/gossiper_test.go +++ b/discovery/gossiper_test.go @@ -211,8 +211,9 @@ func (r *mockGraphSource) ForEachNode( return nil } -func (r *mockGraphSource) ForAllOutgoingChannels(cb func( - i *models.ChannelEdgeInfo, c *models.ChannelEdgePolicy) error) error { +func (r *mockGraphSource) ForAllOutgoingChannels(_ context.Context, + cb func(i *models.ChannelEdgeInfo, + c *models.ChannelEdgePolicy) error) error { r.mu.Lock() defer r.mu.Unlock() @@ -3716,7 +3717,7 @@ out: // policy of all of them. const newTimeLockDelta = 100 var edgesToUpdate []EdgeWithInfo - err = ctx.router.ForAllOutgoingChannels(func( + err = ctx.router.ForAllOutgoingChannels(context.Background(), func( info *models.ChannelEdgeInfo, edge *models.ChannelEdgePolicy) error { diff --git a/graph/builder.go b/graph/builder.go index d590fb896..073716a83 100644 --- a/graph/builder.go +++ b/graph/builder.go @@ -1275,10 +1275,9 @@ func (b *Builder) FetchLightningNode(ctx context.Context, // the router. // // NOTE: This method is part of the ChannelGraphSource interface. -func (b *Builder) ForAllOutgoingChannels(cb func(*models.ChannelEdgeInfo, - *models.ChannelEdgePolicy) error) error { - - ctx := context.TODO() +func (b *Builder) ForAllOutgoingChannels(ctx context.Context, + cb func(*models.ChannelEdgeInfo, + *models.ChannelEdgePolicy) error) error { return b.cfg.Graph.ForEachNodeChannel(ctx, b.cfg.SelfNode, func(c *models.ChannelEdgeInfo, e *models.ChannelEdgePolicy, diff --git a/graph/interfaces.go b/graph/interfaces.go index 9d576e4bc..20b63dd15 100644 --- a/graph/interfaces.go +++ b/graph/interfaces.go @@ -70,8 +70,9 @@ type ChannelGraphSource interface { // ForAllOutgoingChannels is used to iterate over all channels // emanating from the "source" node which is the center of the // star-graph. - ForAllOutgoingChannels(cb func(c *models.ChannelEdgeInfo, - e *models.ChannelEdgePolicy) error) error + ForAllOutgoingChannels(ctx context.Context, + cb func(c *models.ChannelEdgeInfo, + e *models.ChannelEdgePolicy) error) error // CurrentBlockHeight returns the block height from POV of the router // subsystem.