graphdb: pass context to PutClosedScid
This commit is contained in:
8 files changed
+25
-12
No files matched your search
+6
-3
@@ -1,6 +1,7 @@
|
||||
package discovery
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"math"
|
||||
"sync"
|
||||
@@ -55,7 +56,7 @@ type ClosedChannelTracker interface {
|
||||
type GraphCloser interface {
|
||||
// PutClosedScid marks a channel as closed so that we won't validate
|
||||
// channel announcements for it again.
|
||||
PutClosedScid(lnwire.ShortChannelID) error
|
||||
PutClosedScid(context.Context, lnwire.ShortChannelID) error
|
||||
|
||||
// IsClosedScid checks if a short channel id is closed.
|
||||
IsClosedScid(lnwire.ShortChannelID) (bool, error)
|
||||
@@ -88,8 +89,10 @@ func NewScidCloserMan(graph GraphCloser,
|
||||
|
||||
// PutClosedScid marks scid as closed so the gossiper can ignore this channel
|
||||
// in the future.
|
||||
func (s *ScidCloserMan) PutClosedScid(scid lnwire.ShortChannelID) error {
|
||||
return s.graph.PutClosedScid(scid)
|
||||
func (s *ScidCloserMan) PutClosedScid(ctx context.Context,
|
||||
scid lnwire.ShortChannelID) error {
|
||||
|
||||
return s.graph.PutClosedScid(ctx, scid)
|
||||
}
|
||||
|
||||
// IsClosedScid checks whether scid is closed so that the gossiper can ignore
|
||||
|
||||
@@ -2877,7 +2877,9 @@ func (d *AuthenticatedGossiper) handleChanAnnouncement(ctx context.Context,
|
||||
// expensive validation checks on it again.
|
||||
// TODO: Populate the ScidCloser by using closed
|
||||
// channel notifications.
|
||||
dbErr := d.cfg.ScidCloser.PutClosedScid(scid)
|
||||
dbErr := d.cfg.ScidCloser.PutClosedScid(
|
||||
ctx, scid,
|
||||
)
|
||||
if dbErr != nil {
|
||||
log.Errorf("failed to mark scid(%v) "+
|
||||
"as closed: %v", scid, dbErr)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package discovery
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"sync"
|
||||
@@ -176,7 +177,9 @@ func newMockScidCloser(channelPeer bool) *mockScidCloser {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *mockScidCloser) PutClosedScid(scid lnwire.ShortChannelID) error {
|
||||
func (m *mockScidCloser) PutClosedScid(_ context.Context,
|
||||
scid lnwire.ShortChannelID) error {
|
||||
|
||||
m.Lock()
|
||||
m.m[scid] = struct{}{}
|
||||
m.Unlock()
|
||||
|
||||
Reference in new issue
Block a user