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:
Elle Mouton committed 2026-02-20 08:46:58 +02:00
1 parent 2aaa52adf9
commit 3ea2423f25
6 files changed
+85 -59

No files matched your search

+7 -2
View File
@@ -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)