graph/db: thread context to AddLightningNode
This commit is contained in:
15 files changed
+126
-81
No files matched your search
@@ -2,6 +2,7 @@ package graph
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
@@ -106,7 +107,7 @@ func TestIgnoreNodeAnnouncement(t *testing.T) {
|
||||
}
|
||||
copy(node.PubKeyBytes[:], pub.SerializeCompressed())
|
||||
|
||||
err := ctx.builder.AddNode(node)
|
||||
err := ctx.builder.AddNode(context.Background(), node)
|
||||
if !IsError(err, ErrIgnored) {
|
||||
t.Fatalf("expected to get ErrIgnore, instead got: %v", err)
|
||||
}
|
||||
@@ -1068,7 +1069,7 @@ func TestIsStaleNode(t *testing.T) {
|
||||
Features: testFeatures,
|
||||
}
|
||||
copy(n1.PubKeyBytes[:], priv1.PubKey().SerializeCompressed())
|
||||
if err := ctx.builder.AddNode(n1); err != nil {
|
||||
if err := ctx.builder.AddNode(context.Background(), n1); err != nil {
|
||||
t.Fatalf("could not add node: %v", err)
|
||||
}
|
||||
|
||||
@@ -1328,6 +1329,8 @@ func createTestCtxFromFile(t *testing.T,
|
||||
func parseTestGraph(t *testing.T, useCache bool, path string) (
|
||||
*testGraphInstance, error) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
graphJSON, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -1434,7 +1437,7 @@ func parseTestGraph(t *testing.T, useCache bool, path string) (
|
||||
|
||||
// With the node fully parsed, add it as a vertex within the
|
||||
// graph.
|
||||
if err := graph.AddLightningNode(dbNode); err != nil {
|
||||
if err := graph.AddLightningNode(ctx, dbNode); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -1715,6 +1718,8 @@ func createTestGraphFromChannels(t *testing.T, useCache bool,
|
||||
testChannels []*testChannel, source string) (*testGraphInstance,
|
||||
error) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
// We'll use this fake address for the IP address of all the nodes in
|
||||
// our tests. This value isn't needed for path finding so it doesn't
|
||||
// need to be unique.
|
||||
@@ -1763,7 +1768,7 @@ func createTestGraphFromChannels(t *testing.T, useCache bool,
|
||||
|
||||
// With the node fully parsed, add it as a vertex within the
|
||||
// graph.
|
||||
if err := graph.AddLightningNode(dbNode); err != nil {
|
||||
if err := graph.AddLightningNode(ctx, dbNode); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user