mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-31 08:02:25 +02:00
multi: add reset to ForEachNode
This commit is contained in:
@@ -121,7 +121,7 @@ func (d *dbNode) ForEachChannel(ctx context.Context,
|
||||
//
|
||||
// NOTE: Part of the autopilot.ChannelGraph interface.
|
||||
func (d *databaseChannelGraph) ForEachNode(ctx context.Context,
|
||||
cb func(context.Context, Node) error, _ func()) error {
|
||||
cb func(context.Context, Node) error, reset func()) error {
|
||||
|
||||
return d.db.ForEachNode(ctx, func(nodeTx graphdb.NodeRTx) error {
|
||||
// We'll skip over any node that doesn't have any advertised
|
||||
@@ -136,7 +136,7 @@ func (d *databaseChannelGraph) ForEachNode(ctx context.Context,
|
||||
}
|
||||
|
||||
return cb(ctx, node)
|
||||
})
|
||||
}, reset)
|
||||
}
|
||||
|
||||
// databaseChannelGraphCached wraps a channeldb.ChannelGraph instance with the
|
||||
|
@@ -229,7 +229,7 @@ type GraphSource interface {
|
||||
// the callback returns an error, then the transaction is aborted and
|
||||
// the iteration stops early. Any operations performed on the NodeTx
|
||||
// passed to the call-back are executed under the same read transaction.
|
||||
ForEachNode(context.Context, func(graphdb.NodeRTx) error) error
|
||||
ForEachNode(context.Context, func(graphdb.NodeRTx) error, func()) error
|
||||
|
||||
// ForEachNodeCached is similar to ForEachNode, but it utilizes the
|
||||
// channel graph cache if one is available. It is less consistent than
|
||||
|
Reference in New Issue
Block a user