graph/db: add gossip version parameter to ForEachChannel

Update ForEachChannel to accept a gossip version parameter, allowing
callers to specify which gossip version's channels should be iterated.
This change prepares the graph database for supporting multiple gossip
versions while maintaining backward compatibility.

The KVStore implementation validates that only GossipVersion1 is
requested, returning ErrVersionNotSupportedForKVDB for other versions.
The SQLStore implementation validates known versions and passes the
version through to the underlying paginated query.

Update VersionedGraph to include a ForEachChannel method that
automatically uses its configured gossip version, and update the
DescribeGraph RPC handler to use the v1Graph instead of the global
graphDB.
This commit is contained in:
Elle Mouton committed 2026-02-13 07:21:24 +02:00
1 parent 506ec037e2
commit 0cfb9c9d2c
7 files changed
+92 -65

No files matched your search

+5 -4
View File
@@ -6853,10 +6853,11 @@ func (r *rpcServer) DescribeGraph(ctx context.Context,
}
}
// Obtain the pointer to the global singleton channel graph, this will
// provide a consistent view of the graph due to bolt db's
// transactional model.
graph := r.server.graphDB
// Obtain the pointer to the V1 channel graph. This will provide a
// consistent view of the graph due to bolt db's transactional model.
//
// TODO(elle): switch to a cross-version graph view when available.
graph := r.server.v1Graph
// First iterate through all the known nodes (connected or unconnected
// within the graph), collating their current state into the RPC