graph/db: version ForEachSourceNodeChannel
Add a gossip version parameter to ForEachSourceNodeChannel in the Store interface and both KV/SQL implementations. The VersionedGraph wrapper delegates with its baked-in version. Convert the testAddChannelEdgeShellNodes and testForEachSourceNodeChannel tests to run against both v1 and v2 gossip versions.
This commit is contained in:
6 files changed
+85
-59
No files matched your search
@@ -3722,8 +3722,13 @@ func (c *KVStore) ForEachNodeChannel(_ context.Context,
|
||||
// channel's outpoint, whether we have a policy for the channel and the channel
|
||||
// peer's node information.
|
||||
func (c *KVStore) ForEachSourceNodeChannel(_ context.Context,
|
||||
cb func(chanPoint wire.OutPoint, havePolicy bool,
|
||||
otherNode *models.Node) error, reset func()) error {
|
||||
v lnwire.GossipVersion, cb func(chanPoint wire.OutPoint,
|
||||
havePolicy bool, otherNode *models.Node) error,
|
||||
reset func()) error {
|
||||
|
||||
if v != lnwire.GossipVersion1 {
|
||||
return ErrVersionNotSupportedForKVDB
|
||||
}
|
||||
|
||||
return kvdb.View(c.db, func(tx kvdb.RTx) error {
|
||||
nodes := tx.ReadBucket(nodeBucket)
|
||||
|
||||
Reference in new issue
Block a user