124 Commits
Author SHA1 Message Date
Elle Mouton 262e9208b9 graphdb: thread topology update context 2026-02-25 16:11:47 +02:00
Elle Mouton 0bb0d66952 graphdb: pass context to GraphSession 2026-02-25 16:11:46 +02:00
Elle Mouton 8722a96a4e graphdb: pass context to IsClosedScid 2026-02-25 16:11:46 +02:00
Elle Mouton 4dcaf1c16a graphdb: pass context to PutClosedScid 2026-02-25 16:11:46 +02:00
Elle Mouton 68c5206017 graphdb: pass context to AddEdgeProof 2026-02-25 16:11:46 +02:00
Elle Mouton 3dc2efd7f3 graphdb: pass context to DisconnectBlockAtHeight 2026-02-25 16:11:46 +02:00
Elle Mouton a31c86b0ee graphdb: pass context to PruneTip 2026-02-25 16:11:46 +02:00
Elle Mouton 9f855175d5 graphdb: pass context to ChannelView 2026-02-25 16:11:46 +02:00
Elle Mouton 7dbaa691c4 graphdb: pass context to PruneGraph 2026-02-25 16:11:46 +02:00
Elle Mouton 13668ce45f graphdb: pass context to PruneGraphNodes 2026-02-25 16:11:46 +02:00
Elle Mouton 072244ee18 graphdb: pass context to FilterKnownChanIDs 2026-02-25 16:11:46 +02:00
Elle Mouton 46d37a691f graphdb: pass context to FetchChanInfos 2026-02-25 16:11:46 +02:00
Elle Mouton f62ea62cfe graphdb: pass context to IsPublicNode 2026-02-25 16:11:42 +02:00
Elle Mouton 397330cbdb graphdb: pass context to ChannelID 2026-02-25 16:11:29 +02:00
Elle Mouton 3079c07afb graphdb: pass context to HasChannelEdge 2026-02-25 16:11:29 +02:00
Elle Mouton 87ed09a829 graphdb: pass context to HasV1ChannelEdge 2026-02-25 16:11:29 +02:00
Elle Mouton 1d4c6aadb4 graph/db: thread context through FetchChannelEdgesByOutpoint 2026-02-25 16:11:29 +02:00
Elle Mouton 6bbb9a32fc graph/db: thread context through FetchChannelEdgesByID 2026-02-25 16:11:25 +02:00
Elle Mouton acdef84d30 graph/db: thread context through DeleteChannelEdges 2026-02-25 15:33:59 +02:00
Elle Mouton 37cc6b29d9 graph/db: thread context through NumZombies 2026-02-25 15:33:34 +02:00
Elle Mouton f98905ae99 graph/db: thread context through IsZombieEdge 2026-02-25 15:33:34 +02:00
Elle Mouton 8a96e5f3d2 graph/db: thread context through MarkEdgeLive 2026-02-25 15:33:34 +02:00
Elle Mouton c270367071 graph/db: thread context through MarkEdgeZombie 2026-02-25 15:33:34 +02:00
Elle Mouton bb38aa8922 graph/db: thread context through FilterChannelRange 2026-02-25 15:33:34 +02:00
Elle Mouton e8e714f6a3 graph/db: thread context through ForEachChannelCacheable 2026-02-25 15:33:34 +02:00
Elle Mouton dc9dae8dd6 graph/db: thread context through ChanUpdatesInHorizon 2026-02-25 15:33:34 +02:00
Elle Mouton 6ccf93c2c9 graph/db: thread context through ForEachNodeDirectedChannel 2026-02-25 15:33:34 +02:00
Elle Mouton 2f0d2962dd graph/db: thread context through NodeUpdatesInHorizon 2026-02-25 15:33:34 +02:00
Elle Mouton 0597250ae4 graph/db: thread context through DisabledChannelIDs 2026-02-25 15:33:33 +02:00
Elle Mouton b1873e63ec graph/db: thread context through FetchNodeFeatures 2026-02-25 15:32:05 +02:00
Elle Mouton acb3240d3d graph/db: version fetch chan infos
Add a gossip version parameter to FetchChanInfos in the Store interface
and both KV/SQL implementations. Update the graph builder caller and
refactor related tests.
2026-02-20 09:28:13 +02:00
Elle Mouton 769d6260f5 graph/db: version highest chan id
Add a gossip version parameter to HighestChanID in the Store interface
and both KV/SQL implementations. Update callers in the discovery
ChanSeries and server bootstrap code.
2026-02-20 09:28:13 +02:00
Elle Mouton fc19a24d07 graph/db: version disabled channel IDs
Add a gossip version parameter to DisabledChannelIDs in the Store
interface and both implementations. Add a new version-filtered SQL
query and update the builder caller.
2026-02-20 09:19:23 +02:00
Elle Mouton 672b999d22 graph/db: version edge info and policy update tests
Convert testEdgeInfoUpdates and testBatchedUpdateEdgePolicy to run
against both v1 and v2 gossip versions, exercising the versioned
Store methods added in prior commits.
2026-02-20 09:19:23 +02:00
Elle Mouton 28fe3585ac graph/db: version ChannelID lookup
Add a gossip version parameter to the ChannelID method (outpoint to
short channel ID lookup) in the Store interface and both KV/SQL
implementations. Update the VersionedGraph wrapper and tests.
2026-02-20 09:19:22 +02:00
Elle Mouton 0b1a1e3dc5 graph/db: version ForEachNodeDirectedChannel and cacheable traversal
Add a gossip version parameter to ForEachNodeDirectedChannel on the
Store interface and both DB implementations (KVStore, SQLStore). The
NodeTraverser and routing.Graph interfaces remain unversioned since
pathfinding operates on the merged cross-version cache view.

The cache population in populateCache is updated in the same commit
because it is logically atomic with the versioning changes: the graph
cache is the unversioned, merged view used by pathfinding, so it must
be populated with data from all gossip versions. Without this change,
only v1 data would be loaded into the cache, making v2 nodes and
channels invisible to pathfinding.
2026-02-20 08:50:46 +02:00
Elle Mouton f5c91691bc graph/db: version cacheable iteration methods
Add gossip version parameters to ForEachNodeCacheable and
ForEachChannelCacheable in the Store interface and both implementations.

Thread the version through SQL helpers and update call sites/tests
accordingly.
2026-02-20 08:50:43 +02:00
Elle Mouton 3ea2423f25 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.
2026-02-20 08:46:58 +02:00
Elle Mouton 1e35f258e4 graph/db: add gossip version parameter to ForEachNodeChannel
Update ForEachNodeChannel to accept a gossip version parameter,
allowing callers to specify which gossip version's channels should be
iterated. This change mirrors the approach taken in ForEachChannel and
prepares the graph database for supporting multiple gossip versions
while maintaining backward compatibility.

The Store interface is updated to include the version parameter, and
both KVStore and SQLStore implementations are updated accordingly:

- KVStore validates that only GossipVersion1 is requested, returning
  ErrVersionNotSupportedForKVDB for other versions.
- SQLStore passes the version through to the underlying node query,
  enabling version-specific channel iteration.

The ChannelGraph wrapper is updated to accept and pass through the
version parameter. VersionedGraph gains a ForEachNodeChannel method
that automatically uses its configured gossip version, providing a
clean interface for version-specific operations.

Update all call sites to explicitly pass lnwire.GossipVersion1, except
for the local channel manager in server.go which now uses the v1Graph
directly (matching the pattern used in other parts of the codebase).
2026-02-13 07:21:24 +02:00
Elle Mouton 0cfb9c9d2c 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.
2026-02-13 07:21:24 +02:00
Elle Mouton 506ec037e2 graph/db: add versioned HasChannelEdge method
Add a new HasChannelEdge method that takes a gossip version parameter
and returns only existence and zombie status, without timestamp data.
This supports both v1 and v2 gossip protocols.

The original HasChannelEdge method is renamed to HasV1ChannelEdge to
preserve v1-specific functionality for callers that need timestamp
information. All call sites are updated accordingly.

The SQL store implementation now handles both gossip versions, using
timestamps for v1 and block heights for v2 policies, with proper
reject cache support for both versions.
2026-02-13 07:21:24 +02:00
Elle Mouton 03050a589d graph/db: add version parameter to IsZombieEdge
Make IsZombieEdge version-aware and add corresponding method to
VersionedGraph. Convert TestEdgeInsertionDeletion to versioned test
using the createEdge helper for both v1 and v2 channel testing.
2026-02-13 07:21:23 +02:00
Elle Mouton d88fa01162 graph/db: add version parameter to FetchChannelEdgesByID/Outpoint
Make channel edge fetching version-aware by adding gossip version
parameter to FetchChannelEdgesByID and FetchChannelEdgesByOutpoint.
Add corresponding methods to VersionedGraph. V2 policy building is
marked as TODO.
2026-02-13 07:21:23 +02:00
Elle Mouton 971c0f6eb8 graph/db: add version parameter to IsPublicNode
Make IsPublicNode version-aware by routing to the appropriate SQL
query based on gossip version. V1 and v2 have different criteria for
determining node publicity (v1 requires four signatures, v2 requires
one). Convert TestNodeIsPublic to versioned test for both protocols.
2026-02-13 07:21:23 +02:00
Elle Mouton b3cf9a806f multi: add DeleteChannelEdges to VersionedGraph
Add version-aware DeleteChannelEdges method to VersionedGraph and
update call sites in graph builder, rpcserver, and server to use
versioned graphs. This ensures channel deletion operations are
properly scoped to the correct gossip version.
2026-02-13 07:21:23 +02:00
Elle Mouton a73189ccec graph/db: add version parameter to DeleteChannelEdges
Thread the gossip version through DeleteChannelEdges to enable
version-aware channel deletion. The KVStore rejects non-v1 versions
while SQLStore properly passes the version to the underlying queries.
This prepares for v2 channel zombie handling (strict zombie pruning
for v2 is marked as TODO).
2026-02-13 07:21:22 +02:00
Elle Mouton 7bb38651d9 graph/db: convert other node CRUD methods
Convert a few more CRUD methods to handle v2 nodes. Then update some
more tests to be run against both v1 and v2 nodes.
2026-02-13 07:21:21 +02:00
Elle Mouton 4db5198079 graph/db: introduce VersionedGraph
For now, all instances will use V1 only so as not to change behaviour
yet.
2026-02-13 07:21:21 +02:00
Elle Mouton c281810ab9 graph/db: move gossip versions up one layer
Update some of the node related graph CRUD methods to take a version
rather than hardcoding them in the SQLStore layer. Move the version up
one layer instead. This will make it easier to make it configurable
later on.
2026-02-13 07:21:20 +02:00
Elle Mouton 97143a74ab graph/db: split HasNode into two methods
HasNode currently is very v1 specific since it returns a time.Time
timestamp which is specific to V1 node announcements. However, it is
mostly only used for the "exists" return value. So here we split it up
into HasNode which just checks existence and HasV1Node which retains the
same behavaiour as before.
2026-02-13 07:21:20 +02:00