diff --git a/graph/db/graph.go b/graph/db/graph.go index 1659ed941..0051e8d0e 100644 --- a/graph/db/graph.go +++ b/graph/db/graph.go @@ -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. diff --git a/graph/db/graph_test.go b/graph/db/graph_test.go index c223c10e4..d16261137 100644 --- a/graph/db/graph_test.go +++ b/graph/db/graph_test.go @@ -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) diff --git a/graph/db/interfaces.go b/graph/db/interfaces.go index a1dda31f0..4d52fbf8c 100644 --- a/graph/db/interfaces.go +++ b/graph/db/interfaces.go @@ -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 diff --git a/graph/db/kv_store.go b/graph/db/kv_store.go index 4cfcedb0b..72d63f519 100644 --- a/graph/db/kv_store.go +++ b/graph/db/kv_store.go @@ -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 { diff --git a/graph/db/sql_store.go b/graph/db/sql_store.go index 388b25baa..06f099dce 100644 --- a/graph/db/sql_store.go +++ b/graph/db/sql_store.go @@ -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 { diff --git a/rpcserver.go b/rpcserver.go index bf01fc82f..531443fc3 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -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