graphdb: pass context to AddEdgeProof
This commit is contained in:
6 files changed
+9
-10
No files matched your search
+1
-1
@@ -1312,7 +1312,7 @@ func (b *Builder) ForAllOutgoingChannels(ctx context.Context,
|
|||||||
func (b *Builder) AddProof(chanID lnwire.ShortChannelID,
|
func (b *Builder) AddProof(chanID lnwire.ShortChannelID,
|
||||||
proof *models.ChannelAuthProof) error {
|
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
|
// IsStaleNode returns true if the graph source has a node announcement for the
|
||||||
|
|||||||
+3
-3
@@ -692,10 +692,10 @@ func (c *ChannelGraph) HasChannelEdge(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddEdgeProof sets the proof of an existing edge in the graph database.
|
// AddEdgeProof sets the proof of an existing edge in the graph database.
|
||||||
func (c *ChannelGraph) AddEdgeProof(chanID lnwire.ShortChannelID,
|
func (c *ChannelGraph) AddEdgeProof(ctx context.Context,
|
||||||
proof *models.ChannelAuthProof) error {
|
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.
|
// HighestChanID returns the "highest" known channel ID in the channel graph.
|
||||||
|
|||||||
@@ -1611,7 +1611,7 @@ func testAddEdgeProof(t *testing.T, v lnwire.GossipVersion) {
|
|||||||
|
|
||||||
// Now add just the proof via AddEdgeProof.
|
// Now add just the proof via AddEdgeProof.
|
||||||
scid1 := lnwire.NewShortChanIDFromInt(edge1.ChannelID)
|
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.
|
// Fetch the edge again and assert that the proof is now set.
|
||||||
dbEdge, _, _, err = graph.FetchChannelEdgesByID(
|
dbEdge, _, _, err = graph.FetchChannelEdgesByID(
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ type Store interface { //nolint:interfacebloat
|
|||||||
|
|
||||||
// AddEdgeProof sets the proof of an existing edge in the graph
|
// AddEdgeProof sets the proof of an existing edge in the graph
|
||||||
// database.
|
// database.
|
||||||
AddEdgeProof(chanID lnwire.ShortChannelID,
|
AddEdgeProof(ctx context.Context, chanID lnwire.ShortChannelID,
|
||||||
proof *models.ChannelAuthProof) error
|
proof *models.ChannelAuthProof) error
|
||||||
|
|
||||||
// ChannelID attempt to lookup the 8-byte compact channel ID which maps
|
// ChannelID attempt to lookup the 8-byte compact channel ID which maps
|
||||||
|
|||||||
@@ -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.
|
// 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 {
|
proof *models.ChannelAuthProof) error {
|
||||||
|
|
||||||
// We only support v1 channel proofs in the KVStore.
|
// We only support v1 channel proofs in the KVStore.
|
||||||
|
|||||||
@@ -3198,8 +3198,8 @@ func (s *SQLStore) DisconnectBlockAtHeight(ctx context.Context,
|
|||||||
// AddEdgeProof sets the proof of an existing edge in the graph database.
|
// AddEdgeProof sets the proof of an existing edge in the graph database.
|
||||||
//
|
//
|
||||||
// NOTE: part of the Store interface.
|
// NOTE: part of the Store interface.
|
||||||
func (s *SQLStore) AddEdgeProof(scid lnwire.ShortChannelID,
|
func (s *SQLStore) AddEdgeProof(ctx context.Context,
|
||||||
proof *models.ChannelAuthProof) error {
|
scid lnwire.ShortChannelID, proof *models.ChannelAuthProof) error {
|
||||||
|
|
||||||
if !isKnownGossipVersion(proof.Version) {
|
if !isKnownGossipVersion(proof.Version) {
|
||||||
return fmt.Errorf("unsupported gossip version: %d",
|
return fmt.Errorf("unsupported gossip version: %d",
|
||||||
@@ -3207,7 +3207,6 @@ func (s *SQLStore) AddEdgeProof(scid lnwire.ShortChannelID,
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ctx = context.TODO()
|
|
||||||
scidBytes = channelIDToBytes(scid.ToUint64())
|
scidBytes = channelIDToBytes(scid.ToUint64())
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user