From 68c520601727c768b0c3ef1038c2f03964b713d9 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Wed, 25 Feb 2026 12:36:30 +0200 Subject: [PATCH] graphdb: pass context to AddEdgeProof --- graph/builder.go | 2 +- graph/db/graph.go | 6 +++--- graph/db/graph_test.go | 2 +- graph/db/interfaces.go | 2 +- graph/db/kv_store.go | 2 +- graph/db/sql_store.go | 5 ++--- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/graph/builder.go b/graph/builder.go index a47cc18d1..391195fca 100644 --- a/graph/builder.go +++ b/graph/builder.go @@ -1312,7 +1312,7 @@ func (b *Builder) ForAllOutgoingChannels(ctx context.Context, func (b *Builder) AddProof(chanID lnwire.ShortChannelID, proof *models.ChannelAuthProof) error { - return b.cfg.Graph.AddEdgeProof(chanID, proof) + return b.cfg.Graph.AddEdgeProof(context.TODO(), chanID, proof) } // IsStaleNode returns true if the graph source has a node announcement for the diff --git a/graph/db/graph.go b/graph/db/graph.go index c42f54301..66ab6d931 100644 --- a/graph/db/graph.go +++ b/graph/db/graph.go @@ -692,10 +692,10 @@ func (c *ChannelGraph) HasChannelEdge(ctx context.Context, } // AddEdgeProof sets the proof of an existing edge in the graph database. -func (c *ChannelGraph) AddEdgeProof(chanID lnwire.ShortChannelID, - proof *models.ChannelAuthProof) error { +func (c *ChannelGraph) AddEdgeProof(ctx context.Context, + chanID lnwire.ShortChannelID, proof *models.ChannelAuthProof) error { - return c.db.AddEdgeProof(chanID, proof) + return c.db.AddEdgeProof(ctx, chanID, proof) } // HighestChanID returns the "highest" known channel ID in the channel graph. diff --git a/graph/db/graph_test.go b/graph/db/graph_test.go index d9c26a909..d25289b2d 100644 --- a/graph/db/graph_test.go +++ b/graph/db/graph_test.go @@ -1611,7 +1611,7 @@ func testAddEdgeProof(t *testing.T, v lnwire.GossipVersion) { // Now add just the proof via AddEdgeProof. scid1 := lnwire.NewShortChanIDFromInt(edge1.ChannelID) - require.NoError(t, graph.AddEdgeProof(scid1, proof)) + require.NoError(t, graph.AddEdgeProof(ctx, scid1, proof)) // Fetch the edge again and assert that the proof is now set. dbEdge, _, _, err = graph.FetchChannelEdgesByID( diff --git a/graph/db/interfaces.go b/graph/db/interfaces.go index 615b2cb0d..eb3f7e914 100644 --- a/graph/db/interfaces.go +++ b/graph/db/interfaces.go @@ -237,7 +237,7 @@ type Store interface { //nolint:interfacebloat // AddEdgeProof sets the proof of an existing edge in the graph // database. - AddEdgeProof(chanID lnwire.ShortChannelID, + AddEdgeProof(ctx context.Context, chanID lnwire.ShortChannelID, proof *models.ChannelAuthProof) error // ChannelID attempt to lookup the 8-byte compact channel ID which maps diff --git a/graph/db/kv_store.go b/graph/db/kv_store.go index 7a57db673..35842ecee 100644 --- a/graph/db/kv_store.go +++ b/graph/db/kv_store.go @@ -1440,7 +1440,7 @@ func (c *KVStore) HasChannelEdge(ctx context.Context, v lnwire.GossipVersion, } // AddEdgeProof sets the proof of an existing edge in the graph database. -func (c *KVStore) AddEdgeProof(chanID lnwire.ShortChannelID, +func (c *KVStore) AddEdgeProof(_ context.Context, chanID lnwire.ShortChannelID, proof *models.ChannelAuthProof) error { // We only support v1 channel proofs in the KVStore. diff --git a/graph/db/sql_store.go b/graph/db/sql_store.go index f1aad755d..78ef82c98 100644 --- a/graph/db/sql_store.go +++ b/graph/db/sql_store.go @@ -3198,8 +3198,8 @@ func (s *SQLStore) DisconnectBlockAtHeight(ctx context.Context, // AddEdgeProof sets the proof of an existing edge in the graph database. // // NOTE: part of the Store interface. -func (s *SQLStore) AddEdgeProof(scid lnwire.ShortChannelID, - proof *models.ChannelAuthProof) error { +func (s *SQLStore) AddEdgeProof(ctx context.Context, + scid lnwire.ShortChannelID, proof *models.ChannelAuthProof) error { if !isKnownGossipVersion(proof.Version) { return fmt.Errorf("unsupported gossip version: %d", @@ -3207,7 +3207,6 @@ func (s *SQLStore) AddEdgeProof(scid lnwire.ShortChannelID, } var ( - ctx = context.TODO() scidBytes = channelIDToBytes(scid.ToUint64()) )