graphdb: pass context to ChannelID

This commit is contained in:
Elle Mouton committed 2026-02-25 16:11:29 +02:00
1 parent 3079c07afb
commit 397330cbdb
6 files changed
+9 -8

No files matched your search

+4 -2
View File
@@ -986,8 +986,10 @@ func (c *VersionedGraph) HighestChanID(ctx context.Context) (uint64, error) {
}
// ChannelID attempts to lookup the 8-byte compact channel ID.
func (c *VersionedGraph) ChannelID(chanPoint *wire.OutPoint) (uint64, error) {
return c.db.ChannelID(c.v, chanPoint)
func (c *VersionedGraph) ChannelID(ctx context.Context,
chanPoint *wire.OutPoint) (uint64, error) {
return c.db.ChannelID(ctx, c.v, chanPoint)
}
// IsPublicNode determines whether the node is seen as public in the graph.
+1 -1
View File
@@ -1191,7 +1191,7 @@ func testEdgeInfoUpdates(t *testing.T, v lnwire.GossipVersion) {
// We should also be able to retrieve the channelID only knowing the
// channel point of the channel.
dbChanID, err := graph.ChannelID(&outpoint)
dbChanID, err := graph.ChannelID(ctx, &outpoint)
require.NoError(t, err, "unable to retrieve channel ID")
require.Equal(t, chanID, dbChanID)
+1 -1
View File
@@ -242,7 +242,7 @@ type Store interface { //nolint:interfacebloat
// ChannelID attempt to lookup the 8-byte compact channel ID which maps
// to the passed channel point (outpoint). If the passed channel doesn't
// exist within the database, then ErrEdgeNotFound is returned.
ChannelID(v lnwire.GossipVersion,
ChannelID(ctx context.Context, v lnwire.GossipVersion,
chanPoint *wire.OutPoint) (uint64, error)
// HighestChanID returns the "highest" known channel ID in the channel
+1 -1
View File
@@ -2006,7 +2006,7 @@ func (c *KVStore) DeleteChannelEdges(_ context.Context,
// ChannelID attempt to lookup the 8-byte compact channel ID which maps to the
// passed channel point (outpoint). If the passed channel doesn't exist within
// the database, then ErrEdgeNotFound is returned.
func (c *KVStore) ChannelID(v lnwire.GossipVersion,
func (c *KVStore) ChannelID(_ context.Context, v lnwire.GossipVersion,
chanPoint *wire.OutPoint) (uint64, error) {
if v != lnwire.GossipVersion1 {
+1 -2
View File
@@ -2510,11 +2510,10 @@ func (s *SQLStore) HasChannelEdge(ctx context.Context,
// the database, then ErrEdgeNotFound is returned.
//
// NOTE: part of the Store interface.
func (s *SQLStore) ChannelID(v lnwire.GossipVersion,
func (s *SQLStore) ChannelID(ctx context.Context, v lnwire.GossipVersion,
chanPoint *wire.OutPoint) (uint64, error) {
var (
ctx = context.TODO()
channelID uint64
)
err := s.db.ExecTx(ctx, sqldb.ReadTxOpt(), func(db SQLQueries) error {
+1 -1
View File
@@ -3204,7 +3204,7 @@ func abandonChanFromGraph(chanGraph *graphdb.VersionedGraph,
// First, we'll obtain the channel ID. If we can't locate this, then
// it's the case that the channel may have already been removed from
// the graph, so we'll return a nil error.
chanID, err := chanGraph.ChannelID(chanPoint)
chanID, err := chanGraph.ChannelID(context.TODO(), chanPoint)
switch {
case errors.Is(err, graphdb.ErrEdgeNotFound):
return nil