graphdb: pass context to ChannelID
This commit is contained in:
6 files changed
+9
-8
No files matched your search
+4
-2
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user