mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 15:40:59 +02:00
multi: let ForEachNodeChannel take a reset param
This commit is contained in:
@@ -42,7 +42,7 @@ type Manager struct {
|
||||
// channels. The ChannelEdgePolicy parameter may be nil.
|
||||
ForAllOutgoingChannels func(ctx context.Context,
|
||||
cb func(*models.ChannelEdgeInfo,
|
||||
*models.ChannelEdgePolicy) error) error
|
||||
*models.ChannelEdgePolicy) error, reset func()) error
|
||||
|
||||
// FetchChannel is used to query local channel parameters. Optionally an
|
||||
// existing db tx can be supplied.
|
||||
@@ -152,7 +152,14 @@ func (r *Manager) UpdatePolicy(ctx context.Context,
|
||||
// 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
|
||||
// we'll collect them all.
|
||||
err := r.ForAllOutgoingChannels(ctx, processChan)
|
||||
err := r.ForAllOutgoingChannels(
|
||||
ctx, processChan,
|
||||
func() {
|
||||
failedUpdates = nil
|
||||
edgesToUpdate = nil
|
||||
clear(policiesToUpdate)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@@ -125,7 +125,7 @@ func TestManager(t *testing.T) {
|
||||
|
||||
forAllOutgoingChannels := func(_ context.Context,
|
||||
cb func(*models.ChannelEdgeInfo,
|
||||
*models.ChannelEdgePolicy) error) error {
|
||||
*models.ChannelEdgePolicy) error, _ func()) error {
|
||||
|
||||
for _, c := range channelSet {
|
||||
if err := cb(c.edgeInfo, ¤tPolicy); err != nil {
|
||||
|
Reference in New Issue
Block a user