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.
This commit is contained in:
Elle Mouton committed 2026-02-20 09:19:22 +02:00
1 parent 2f6cc185a7
commit 28fe3585ac
5 files changed
+26 -9

No files matched your search

+4 -2
View File
@@ -2507,7 +2507,9 @@ func (s *SQLStore) HasChannelEdge(v lnwire.GossipVersion,
// the database, then ErrEdgeNotFound is returned.
//
// NOTE: part of the Store interface.
func (s *SQLStore) ChannelID(chanPoint *wire.OutPoint) (uint64, error) {
func (s *SQLStore) ChannelID(v lnwire.GossipVersion,
chanPoint *wire.OutPoint) (uint64, error) {
var (
ctx = context.TODO()
channelID uint64
@@ -2516,7 +2518,7 @@ func (s *SQLStore) ChannelID(chanPoint *wire.OutPoint) (uint64, error) {
chanID, err := db.GetSCIDByOutpoint(
ctx, sqlc.GetSCIDByOutpointParams{
Outpoint: chanPoint.String(),
Version: int16(lnwire.GossipVersion1),
Version: int16(v),
},
)
if errors.Is(err, sql.ErrNoRows) {