graph: remove one context.TODO

By threading a context through to the Builder's ForAllOutgoingChannels
method.
This commit is contained in:
Elle Mouton committed 2025-07-08 15:11:02 +02:00
1 parent 3d5e852c8c
commit 793c1057bb
4 files changed
+11 -10

No files matched your search

+1 -1
View File
@@ -1709,7 +1709,7 @@ func (d *AuthenticatedGossiper) retransmitStaleAnns(ctx context.Context,
havePublicChannels bool havePublicChannels bool
edgesToUpdate []updateTuple edgesToUpdate []updateTuple
) )
err := d.cfg.Graph.ForAllOutgoingChannels(func( err := d.cfg.Graph.ForAllOutgoingChannels(ctx, func(
info *models.ChannelEdgeInfo, info *models.ChannelEdgeInfo,
edge *models.ChannelEdgePolicy) error { edge *models.ChannelEdgePolicy) error {
+4 -3
View File
@@ -211,8 +211,9 @@ func (r *mockGraphSource) ForEachNode(
return nil return nil
} }
func (r *mockGraphSource) ForAllOutgoingChannels(cb func( func (r *mockGraphSource) ForAllOutgoingChannels(_ context.Context,
i *models.ChannelEdgeInfo, c *models.ChannelEdgePolicy) error) error { cb func(i *models.ChannelEdgeInfo,
c *models.ChannelEdgePolicy) error) error {
r.mu.Lock() r.mu.Lock()
defer r.mu.Unlock() defer r.mu.Unlock()
@@ -3716,7 +3717,7 @@ out:
// policy of all of them. // policy of all of them.
const newTimeLockDelta = 100 const newTimeLockDelta = 100
var edgesToUpdate []EdgeWithInfo var edgesToUpdate []EdgeWithInfo
err = ctx.router.ForAllOutgoingChannels(func( err = ctx.router.ForAllOutgoingChannels(context.Background(), func(
info *models.ChannelEdgeInfo, info *models.ChannelEdgeInfo,
edge *models.ChannelEdgePolicy) error { edge *models.ChannelEdgePolicy) error {
+3 -4
View File
@@ -1275,10 +1275,9 @@ func (b *Builder) FetchLightningNode(ctx context.Context,
// the router. // the router.
// //
// NOTE: This method is part of the ChannelGraphSource interface. // NOTE: This method is part of the ChannelGraphSource interface.
func (b *Builder) ForAllOutgoingChannels(cb func(*models.ChannelEdgeInfo, func (b *Builder) ForAllOutgoingChannels(ctx context.Context,
*models.ChannelEdgePolicy) error) error { cb func(*models.ChannelEdgeInfo,
*models.ChannelEdgePolicy) error) error {
ctx := context.TODO()
return b.cfg.Graph.ForEachNodeChannel(ctx, b.cfg.SelfNode, return b.cfg.Graph.ForEachNodeChannel(ctx, b.cfg.SelfNode,
func(c *models.ChannelEdgeInfo, e *models.ChannelEdgePolicy, func(c *models.ChannelEdgeInfo, e *models.ChannelEdgePolicy,
+3 -2
View File
@@ -70,8 +70,9 @@ type ChannelGraphSource interface {
// ForAllOutgoingChannels is used to iterate over all channels // ForAllOutgoingChannels is used to iterate over all channels
// emanating from the "source" node which is the center of the // emanating from the "source" node which is the center of the
// star-graph. // star-graph.
ForAllOutgoingChannels(cb func(c *models.ChannelEdgeInfo, ForAllOutgoingChannels(ctx context.Context,
e *models.ChannelEdgePolicy) error) error cb func(c *models.ChannelEdgeInfo,
e *models.ChannelEdgePolicy) error) error
// CurrentBlockHeight returns the block height from POV of the router // CurrentBlockHeight returns the block height from POV of the router
// subsystem. // subsystem.