graph/db: thread context through to HasLightningNode

This commit is contained in:
Elle Mouton committed 2025-06-17 19:20:56 +02:00
1 parent 66c5a97202
commit dc6259fcc3
12 files changed
+31 -28

No files matched your search

+3 -3
View File
@@ -135,7 +135,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
dbNode, err := graph.FetchLightningNode(ctx, testPub)
require.NoError(t, err, "unable to locate node")
_, exists, err := graph.HasLightningNode(dbNode.PubKeyBytes)
_, exists, err := graph.HasLightningNode(ctx, dbNode.PubKeyBytes)
if err != nil {
t.Fatalf("unable to query for node: %v", err)
} else if !exists {
@@ -288,7 +288,7 @@ func TestPartialNode(t *testing.T) {
dbNode2, err := graph.FetchLightningNode(ctx, pubKey2)
require.NoError(t, err)
_, exists, err := graph.HasLightningNode(dbNode1.PubKeyBytes)
_, exists, err := graph.HasLightningNode(ctx, dbNode1.PubKeyBytes)
require.NoError(t, err)
require.True(t, exists)
@@ -302,7 +302,7 @@ func TestPartialNode(t *testing.T) {
}
compareNodes(t, expectedNode1, dbNode1)
_, exists, err = graph.HasLightningNode(dbNode2.PubKeyBytes)
_, exists, err = graph.HasLightningNode(ctx, dbNode2.PubKeyBytes)
require.NoError(t, err)
require.True(t, exists)
+2 -2
View File
@@ -134,8 +134,8 @@ type V1Store interface { //nolint:interfacebloat
// database, a timestamp of when the data for the node was lasted
// updated is returned along with a true boolean. Otherwise, an empty
// time.Time is returned with a false boolean.
HasLightningNode(nodePub [33]byte) (time.Time, bool,
error)
HasLightningNode(ctx context.Context, nodePub [33]byte) (time.Time,
bool, error)
// IsPublicNode is a helper method that determines whether the node with
// the given public key is seen as a public node in the graph from the
+2 -2
View File
@@ -3065,8 +3065,8 @@ func (c *KVStore) fetchLightningNode(tx kvdb.RTx,
// timestamp of when the data for the node was lasted updated is returned along
// with a true boolean. Otherwise, an empty time.Time is returned with a false
// boolean.
func (c *KVStore) HasLightningNode(nodePub [33]byte) (time.Time, bool,
error) {
func (c *KVStore) HasLightningNode(_ context.Context,
nodePub [33]byte) (time.Time, bool, error) {
var (
updateTime time.Time
+2 -4
View File
@@ -217,10 +217,8 @@ func (s *SQLStore) FetchLightningNode(ctx context.Context,
// boolean.
//
// NOTE: part of the V1Store interface.
func (s *SQLStore) HasLightningNode(pubKey [33]byte) (time.Time, bool,
error) {
ctx := context.TODO()
func (s *SQLStore) HasLightningNode(ctx context.Context,
pubKey [33]byte) (time.Time, bool, error) {
var (
exists bool