graphdb: pass context to PutClosedScid
This commit is contained in:
8 files changed
+25
-12
No files matched your search
+4
-2
@@ -772,8 +772,10 @@ func (c *ChannelGraph) NumZombies(ctx context.Context) (uint64, error) {
|
||||
}
|
||||
|
||||
// PutClosedScid stores a SCID for a closed channel in the database.
|
||||
func (c *ChannelGraph) PutClosedScid(scid lnwire.ShortChannelID) error {
|
||||
return c.db.PutClosedScid(scid)
|
||||
func (c *ChannelGraph) PutClosedScid(ctx context.Context,
|
||||
scid lnwire.ShortChannelID) error {
|
||||
|
||||
return c.db.PutClosedScid(ctx, scid)
|
||||
}
|
||||
|
||||
// IsClosedScid checks whether a channel identified by the scid is closed.
|
||||
|
||||
@@ -5092,7 +5092,7 @@ func TestClosedScid(t *testing.T) {
|
||||
|
||||
// After we call PutClosedScid, the call to IsClosedScid should return
|
||||
// true.
|
||||
err = graph.PutClosedScid(scid)
|
||||
err = graph.PutClosedScid(t.Context(), scid)
|
||||
require.Nil(t, err)
|
||||
|
||||
exists, err = graph.IsClosedScid(scid)
|
||||
|
||||
@@ -348,7 +348,7 @@ type Store interface { //nolint:interfacebloat
|
||||
// PutClosedScid stores a SCID for a closed channel in the database.
|
||||
// This is so that we can ignore channel announcements that we know to
|
||||
// be closed without having to validate them and fetch a block.
|
||||
PutClosedScid(scid lnwire.ShortChannelID) error
|
||||
PutClosedScid(ctx context.Context, scid lnwire.ShortChannelID) error
|
||||
|
||||
// IsClosedScid checks whether a channel identified by the passed in
|
||||
// scid is closed. This helps avoid having to perform expensive
|
||||
|
||||
@@ -4437,7 +4437,9 @@ func (c *KVStore) NumZombies(_ context.Context) (uint64, error) {
|
||||
// PutClosedScid stores a SCID for a closed channel in the database. This is so
|
||||
// that we can ignore channel announcements that we know to be closed without
|
||||
// having to validate them and fetch a block.
|
||||
func (c *KVStore) PutClosedScid(scid lnwire.ShortChannelID) error {
|
||||
func (c *KVStore) PutClosedScid(_ context.Context,
|
||||
scid lnwire.ShortChannelID) error {
|
||||
|
||||
return kvdb.Update(c.db, func(tx kvdb.RwTx) error {
|
||||
closedScids, err := tx.CreateTopLevelBucket(closedScidBucket)
|
||||
if err != nil {
|
||||
|
||||
@@ -3271,9 +3271,10 @@ func (s *SQLStore) AddEdgeProof(ctx context.Context,
|
||||
// having to validate them and fetch a block.
|
||||
//
|
||||
// NOTE: part of the Store interface.
|
||||
func (s *SQLStore) PutClosedScid(scid lnwire.ShortChannelID) error {
|
||||
func (s *SQLStore) PutClosedScid(ctx context.Context,
|
||||
scid lnwire.ShortChannelID) error {
|
||||
|
||||
var (
|
||||
ctx = context.TODO()
|
||||
chanIDB = channelIDToBytes(scid.ToUint64())
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user