File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -407,7 +407,22 @@ func (c *KVStore) AddrsForNode(ctx context.Context,
407
407
func (c * KVStore ) ForEachChannel (cb func (* models.ChannelEdgeInfo ,
408
408
* models.ChannelEdgePolicy , * models.ChannelEdgePolicy ) error ) error {
409
409
410
- return c .db .View (func (tx kvdb.RTx ) error {
410
+ return forEachChannel (c .db , cb )
411
+ }
412
+
413
+ // forEachChannel iterates through all the channel edges stored within the
414
+ // graph and invokes the passed callback for each edge. The callback takes two
415
+ // edges as since this is a directed graph, both the in/out edges are visited.
416
+ // If the callback returns an error, then the transaction is aborted and the
417
+ // iteration stops early.
418
+ //
419
+ // NOTE: If an edge can't be found, or wasn't advertised, then a nil pointer
420
+ // for that particular channel edge routing policy will be passed into the
421
+ // callback.
422
+ func forEachChannel (db kvdb.Backend , cb func (* models.ChannelEdgeInfo ,
423
+ * models.ChannelEdgePolicy , * models.ChannelEdgePolicy ) error ) error {
424
+
425
+ return db .View (func (tx kvdb.RTx ) error {
411
426
edges := tx .ReadBucket (edgeBucket )
412
427
if edges == nil {
413
428
return ErrGraphNoEdgesFound
You can’t perform that action at this time.
0 commit comments