routing+server: let ForAllOutgoingChannels take a context

And so, remove a previously added context.TODO
This commit is contained in:
Elle Mouton committed 2025-07-08 15:10:30 +02:00
1 parent 046e106a17
commit 85fda8b926
3 files changed
+7 -6

No files matched your search

+3 -2
View File
@@ -40,7 +40,8 @@ type Manager struct {
// ForAllOutgoingChannels is required to iterate over all our local // ForAllOutgoingChannels is required to iterate over all our local
// channels. The ChannelEdgePolicy parameter may be nil. // channels. The ChannelEdgePolicy parameter may be nil.
ForAllOutgoingChannels func(cb func(*models.ChannelEdgeInfo, ForAllOutgoingChannels func(ctx context.Context,
cb func(*models.ChannelEdgeInfo,
*models.ChannelEdgePolicy) error) error *models.ChannelEdgePolicy) error) error
// FetchChannel is used to query local channel parameters. Optionally an // FetchChannel is used to query local channel parameters. Optionally an
@@ -151,7 +152,7 @@ func (r *Manager) UpdatePolicy(ctx context.Context,
// Next, we'll loop over all the outgoing channels the router knows of. // Next, we'll loop over all the outgoing channels the router knows of.
// If we have a filter then we'll only collect those channels, otherwise // If we have a filter then we'll only collect those channels, otherwise
// we'll collect them all. // we'll collect them all.
err := r.ForAllOutgoingChannels(processChan) err := r.ForAllOutgoingChannels(ctx, processChan)
if err != nil { if err != nil {
return nil, err return nil, err
} }
+2 -1
View File
@@ -123,7 +123,8 @@ func TestManager(t *testing.T) {
return nil return nil
} }
forAllOutgoingChannels := func(cb func(*models.ChannelEdgeInfo, forAllOutgoingChannels := func(_ context.Context,
cb func(*models.ChannelEdgeInfo,
*models.ChannelEdgePolicy) error) error { *models.ChannelEdgePolicy) error) error {
for _, c := range channelSet { for _, c := range channelSet {
+2 -3
View File
@@ -1252,11 +1252,10 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
s.localChanMgr = &localchans.Manager{ s.localChanMgr = &localchans.Manager{
SelfPub: nodeKeyDesc.PubKey, SelfPub: nodeKeyDesc.PubKey,
DefaultRoutingPolicy: cc.RoutingPolicy, DefaultRoutingPolicy: cc.RoutingPolicy,
ForAllOutgoingChannels: func(cb func(*models.ChannelEdgeInfo, ForAllOutgoingChannels: func(ctx context.Context,
cb func(*models.ChannelEdgeInfo,
*models.ChannelEdgePolicy) error) error { *models.ChannelEdgePolicy) error) error {
ctx := context.TODO()
return s.graphDB.ForEachNodeChannel(ctx, selfVertex, return s.graphDB.ForEachNodeChannel(ctx, selfVertex,
func(c *models.ChannelEdgeInfo, func(c *models.ChannelEdgeInfo,
e *models.ChannelEdgePolicy, e *models.ChannelEdgePolicy,