graphdb: pass context to AddEdgeProof

This commit is contained in:
Elle Mouton committed 2026-02-25 16:11:46 +02:00
1 parent 3dc2efd7f3
commit 68c5206017
6 files changed
+9 -10

No files matched your search

+1 -1
View File
@@ -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
+3 -3
View File
@@ -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.
+1 -1
View File
@@ -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(
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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.
+2 -3
View File
@@ -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())
)