graphdb: pass context to IsClosedScid
This commit is contained in:
9 files changed
+22
-16
No files matched your search
+4
-4
@@ -59,7 +59,7 @@ type GraphCloser interface {
|
||||
PutClosedScid(context.Context, lnwire.ShortChannelID) error
|
||||
|
||||
// IsClosedScid checks if a short channel id is closed.
|
||||
IsClosedScid(lnwire.ShortChannelID) (bool, error)
|
||||
IsClosedScid(context.Context, lnwire.ShortChannelID) (bool, error)
|
||||
}
|
||||
|
||||
// NodeInfoInquirier handles queries relating to specific nodes and channels
|
||||
@@ -97,10 +97,10 @@ func (s *ScidCloserMan) PutClosedScid(ctx context.Context,
|
||||
|
||||
// IsClosedScid checks whether scid is closed so that the gossiper can ignore
|
||||
// it.
|
||||
func (s *ScidCloserMan) IsClosedScid(scid lnwire.ShortChannelID) (bool,
|
||||
error) {
|
||||
func (s *ScidCloserMan) IsClosedScid(ctx context.Context,
|
||||
scid lnwire.ShortChannelID) (bool, error) {
|
||||
|
||||
return s.graph.IsClosedScid(scid)
|
||||
return s.graph.IsClosedScid(ctx, scid)
|
||||
}
|
||||
|
||||
// IsChannelPeer checks whether we have a channel with the peer.
|
||||
|
||||
@@ -2724,7 +2724,7 @@ func (d *AuthenticatedGossiper) handleChanAnnouncement(ctx context.Context,
|
||||
|
||||
// Check if the channel is already closed in which case we can ignore
|
||||
// it.
|
||||
closed, err := d.cfg.ScidCloser.IsClosedScid(scid)
|
||||
closed, err := d.cfg.ScidCloser.IsClosedScid(ctx, scid)
|
||||
if err != nil {
|
||||
log.Errorf("failed to check if scid %v is closed: %v", scid,
|
||||
err)
|
||||
|
||||
@@ -4793,7 +4793,7 @@ func TestChanAnnBanningNonChanPeer(t *testing.T) {
|
||||
|
||||
// Check that the announcement's scid is marked as closed.
|
||||
isClosed, err := tCtx.gossiper.cfg.ScidCloser.IsClosedScid(
|
||||
ca.ShortChannelID,
|
||||
ctx, ca.ShortChannelID,
|
||||
)
|
||||
require.Nil(t, err)
|
||||
require.True(t, isClosed)
|
||||
|
||||
@@ -187,8 +187,8 @@ func (m *mockScidCloser) PutClosedScid(_ context.Context,
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *mockScidCloser) IsClosedScid(scid lnwire.ShortChannelID) (bool,
|
||||
error) {
|
||||
func (m *mockScidCloser) IsClosedScid(_ context.Context,
|
||||
scid lnwire.ShortChannelID) (bool, error) {
|
||||
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
Reference in new issue
Block a user