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.
This commit is contained in:
Elle Mouton committed 2026-02-13 07:21:24 +02:00
1 parent 4a6213c35e
commit 506ec037e2
8 files changed
+258 -54

No files matched your search

+9 -2
View File
@@ -197,13 +197,20 @@ type Store interface { //nolint:interfacebloat
AddChannelEdge(ctx context.Context, edge *models.ChannelEdgeInfo,
op ...batch.SchedulerOption) error
// HasChannelEdge returns true if the database knows of a channel edge
// HasV1ChannelEdge returns true if the database knows of a channel edge
// with the passed channel ID, and false otherwise. If an edge with that
// ID is found within the graph, then two time stamps representing the
// last time the edge was updated for both directed edges are returned
// along with the boolean. If it is not found, then the zombie index is
// checked and its result is returned as the second boolean.
HasChannelEdge(chanID uint64) (time.Time, time.Time, bool, bool,
HasV1ChannelEdge(chanID uint64) (time.Time, time.Time, bool, bool,
error)
// HasChannelEdge returns true if the database knows of a channel edge
// with the passed channel ID and gossip version, and false otherwise.
// If it is not found, then the zombie index is checked and its result
// is returned as the second boolean.
HasChannelEdge(v lnwire.GossipVersion, chanID uint64) (bool, bool,
error)
// DeleteChannelEdges removes edges with the given channel IDs from the