diff --git a/graph/builder.go b/graph/builder.go index c72b60733..f16441c9d 100644 --- a/graph/builder.go +++ b/graph/builder.go @@ -1417,5 +1417,7 @@ func (b *Builder) IsStaleEdgePolicy(chanID lnwire.ShortChannelID, // // NOTE: This method is part of the ChannelGraphSource interface. func (b *Builder) MarkEdgeLive(chanID lnwire.ShortChannelID) error { - return b.cfg.Graph.MarkEdgeLive(chanID.ToUint64()) + return b.cfg.Graph.MarkEdgeLive( + context.TODO(), chanID.ToUint64(), + ) } diff --git a/graph/db/graph.go b/graph/db/graph.go index 3cc08dad8..b4a811a7e 100644 --- a/graph/db/graph.go +++ b/graph/db/graph.go @@ -343,8 +343,8 @@ func (c *ChannelGraph) AddChannelEdge(ctx context.Context, // MarkEdgeLive clears an edge from our zombie index, deeming it as live. // If the cache is enabled, the edge will be added back to the graph cache if // we still have a record of this channel in the DB. -func (c *ChannelGraph) MarkEdgeLive(chanID uint64) error { - err := c.db.MarkEdgeLive(chanID) +func (c *ChannelGraph) MarkEdgeLive(ctx context.Context, chanID uint64) error { + err := c.db.MarkEdgeLive(ctx, chanID) if err != nil { return err } @@ -547,7 +547,7 @@ func (c *ChannelGraph) FilterKnownChanIDs(chansInfo []ChannelUpdateInfo, // alive, and we let it be added to the set of IDs to query our // peer for. err := c.db.MarkEdgeLive( - info.ShortChannelID.ToUint64(), + context.TODO(), info.ShortChannelID.ToUint64(), ) // Since there is a chance that the edge could have been marked // as "live" between the FilterKnownChanIDs call and the diff --git a/graph/db/graph_test.go b/graph/db/graph_test.go index 159f8b6f1..7e7712be1 100644 --- a/graph/db/graph_test.go +++ b/graph/db/graph_test.go @@ -4580,12 +4580,13 @@ func TestGraphZombieIndex(t *testing.T) { // Similarly, if we mark the same edge as live, we should no longer see // it within the index. - require.NoError(t, graph.MarkEdgeLive(edge.ChannelID)) + require.NoError(t, graph.MarkEdgeLive(ctx, edge.ChannelID)) // Attempting to mark the edge as live again now that it is no longer // in the zombie index should fail. require.ErrorIs( - t, graph.MarkEdgeLive(edge.ChannelID), ErrZombieEdgeNotFound, + t, graph.MarkEdgeLive(ctx, edge.ChannelID), + ErrZombieEdgeNotFound, ) isZombie, _, _, err = graph.IsZombieEdge(edge.ChannelID) diff --git a/graph/db/interfaces.go b/graph/db/interfaces.go index 9f3cebec5..6a6d6b8b8 100644 --- a/graph/db/interfaces.go +++ b/graph/db/interfaces.go @@ -329,7 +329,7 @@ type Store interface { //nolint:interfacebloat // MarkEdgeLive clears an edge from our zombie index, deeming it as // live. - MarkEdgeLive(chanID uint64) error + MarkEdgeLive(ctx context.Context, chanID uint64) error // IsZombieEdge returns whether the edge is considered zombie. If it is // a zombie, then the two node public keys corresponding to this edge diff --git a/graph/db/kv_store.go b/graph/db/kv_store.go index 15140c91a..beda595df 100644 --- a/graph/db/kv_store.go +++ b/graph/db/kv_store.go @@ -4289,7 +4289,7 @@ func markEdgeZombie(zombieIndex kvdb.RwBucket, chanID uint64, pubKey1, } // MarkEdgeLive clears an edge from our zombie index, deeming it as live. -func (c *KVStore) MarkEdgeLive(chanID uint64) error { +func (c *KVStore) MarkEdgeLive(_ context.Context, chanID uint64) error { c.cacheMu.Lock() defer c.cacheMu.Unlock() diff --git a/graph/db/sql_store.go b/graph/db/sql_store.go index 9cab515b6..db900f926 100644 --- a/graph/db/sql_store.go +++ b/graph/db/sql_store.go @@ -1815,12 +1815,11 @@ func (s *SQLStore) MarkEdgeZombie(ctx context.Context, chanID uint64, // MarkEdgeLive clears an edge from our zombie index, deeming it as live. // // NOTE: part of the Store interface. -func (s *SQLStore) MarkEdgeLive(chanID uint64) error { +func (s *SQLStore) MarkEdgeLive(ctx context.Context, chanID uint64) error { s.cacheMu.Lock() defer s.cacheMu.Unlock() var ( - ctx = context.TODO() chanIDB = channelIDToBytes(chanID) )