graph/db: expose reset in ForEachSourceNodeChannel
This commit is contained in:
5 files changed
+19
-12
No files matched your search
@@ -1331,7 +1331,7 @@ func TestForEachSourceNodeChannel(t *testing.T) {
|
||||
delete(expectedSrcChans, chanPoint)
|
||||
|
||||
return nil
|
||||
})
|
||||
}, func() {})
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, expectedSrcChans)
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ type V1Store interface { //nolint:interfacebloat
|
||||
// the channel and the channel peer's node information.
|
||||
ForEachSourceNodeChannel(ctx context.Context,
|
||||
cb func(chanPoint wire.OutPoint, havePolicy bool,
|
||||
otherNode *models.LightningNode) error) error
|
||||
otherNode *models.LightningNode) error,
|
||||
reset func()) error
|
||||
|
||||
// ForEachNodeChannel iterates through all channels of the given node,
|
||||
// executing the passed callback with an edge info structure and the
|
||||
|
||||
@@ -3291,9 +3291,7 @@ func (c *KVStore) ForEachNodeChannel(_ context.Context, nodePub route.Vertex,
|
||||
// peer's node information.
|
||||
func (c *KVStore) ForEachSourceNodeChannel(_ context.Context,
|
||||
cb func(chanPoint wire.OutPoint, havePolicy bool,
|
||||
otherNode *models.LightningNode) error) error {
|
||||
|
||||
reset := func() {}
|
||||
otherNode *models.LightningNode) error, reset func()) error {
|
||||
|
||||
return kvdb.View(c.db, func(tx kvdb.RTx) error {
|
||||
nodes := tx.ReadBucket(nodeBucket)
|
||||
|
||||
@@ -727,9 +727,7 @@ func (s *SQLStore) updateEdgeCache(e *models.ChannelEdgePolicy,
|
||||
// NOTE: part of the V1Store interface.
|
||||
func (s *SQLStore) ForEachSourceNodeChannel(ctx context.Context,
|
||||
cb func(chanPoint wire.OutPoint, havePolicy bool,
|
||||
otherNode *models.LightningNode) error) error {
|
||||
|
||||
reset := func() {}
|
||||
otherNode *models.LightningNode) error, reset func()) error {
|
||||
|
||||
return s.db.ExecTx(ctx, sqldb.ReadTxOpt(), func(db SQLQueries) error {
|
||||
nodeID, nodePub, err := s.getSourceNode(ctx, db, ProtocolV1)
|
||||
|
||||
Reference in new issue
Block a user