channeldb: add tx argument for FetchLightningNode
To allow execution within an existing tx.
This commit is contained in:
9 files changed
+34
-20
No files matched your search
+1
-1
@@ -446,7 +446,7 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig,
|
||||
// we have for the target node from our graph.
|
||||
features := r.DestFeatures
|
||||
if features == nil {
|
||||
targetNode, err := g.graph.FetchLightningNode(target)
|
||||
targetNode, err := g.graph.FetchLightningNode(tx, target)
|
||||
switch {
|
||||
|
||||
// If the node exists and has features, use them directly.
|
||||
|
||||
@@ -2070,7 +2070,7 @@ func TestPathFindSpecExample(t *testing.T) {
|
||||
// Carol, so we set "B" as the source node so path finding starts from
|
||||
// Bob.
|
||||
bob := ctx.aliases["B"]
|
||||
bobNode, err := ctx.graph.FetchLightningNode(bob)
|
||||
bobNode, err := ctx.graph.FetchLightningNode(nil, bob)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to find bob: %v", err)
|
||||
}
|
||||
@@ -2119,7 +2119,7 @@ func TestPathFindSpecExample(t *testing.T) {
|
||||
// Next, we'll set A as the source node so we can assert that we create
|
||||
// the proper route for any queries starting with Alice.
|
||||
alice := ctx.aliases["A"]
|
||||
aliceNode, err := ctx.graph.FetchLightningNode(alice)
|
||||
aliceNode, err := ctx.graph.FetchLightningNode(nil, alice)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to find alice: %v", err)
|
||||
}
|
||||
|
||||
+1
-1
@@ -2089,7 +2089,7 @@ func (r *ChannelRouter) GetChannelByID(chanID lnwire.ShortChannelID) (
|
||||
//
|
||||
// NOTE: This method is part of the ChannelGraphSource interface.
|
||||
func (r *ChannelRouter) FetchLightningNode(node route.Vertex) (*channeldb.LightningNode, error) {
|
||||
return r.cfg.Graph.FetchLightningNode(node)
|
||||
return r.cfg.Graph.FetchLightningNode(nil, node)
|
||||
}
|
||||
|
||||
// ForEachNode is used to iterate over every node in router topology.
|
||||
|
||||
@@ -1319,7 +1319,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
|
||||
t.Fatalf("unable to find any routes: %v", err)
|
||||
}
|
||||
|
||||
copy1, err := ctx.graph.FetchLightningNode(pub1)
|
||||
copy1, err := ctx.graph.FetchLightningNode(nil, pub1)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to fetch node: %v", err)
|
||||
}
|
||||
@@ -1328,7 +1328,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
|
||||
t.Fatalf("fetched node not equal to original")
|
||||
}
|
||||
|
||||
copy2, err := ctx.graph.FetchLightningNode(pub2)
|
||||
copy2, err := ctx.graph.FetchLightningNode(nil, pub2)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to fetch node: %v", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user