mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 22:50:58 +02:00
graph/db: remove kvdb param from test helper
Remove the kvdb.Backend parameter from the `createChannelEdge` helper. This is all in preparation for having the unit tests run against any DB backend.
This commit is contained in:
@@ -597,7 +597,7 @@ func assertEdgeInfoEqual(t *testing.T, e1 *models.ChannelEdgeInfo,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func createChannelEdge(db kvdb.Backend, node1, node2 *models.LightningNode) (
|
func createChannelEdge(node1, node2 *models.LightningNode) (
|
||||||
*models.ChannelEdgeInfo, *models.ChannelEdgePolicy,
|
*models.ChannelEdgeInfo, *models.ChannelEdgePolicy,
|
||||||
*models.ChannelEdgePolicy) {
|
*models.ChannelEdgePolicy) {
|
||||||
|
|
||||||
@@ -693,7 +693,7 @@ func TestEdgeInfoUpdates(t *testing.T) {
|
|||||||
assertNodeInCache(t, graph, node2, testFeatures)
|
assertNodeInCache(t, graph, node2, testFeatures)
|
||||||
|
|
||||||
// Create an edge and add it to the db.
|
// Create an edge and add it to the db.
|
||||||
edgeInfo, edge1, edge2 := createChannelEdge(graph.db, node1, node2)
|
edgeInfo, edge1, edge2 := createChannelEdge(node1, node2)
|
||||||
|
|
||||||
// Make sure inserting the policy at this point, before the edge info
|
// Make sure inserting the policy at this point, before the edge info
|
||||||
// is added, will fail.
|
// is added, will fail.
|
||||||
@@ -3337,7 +3337,7 @@ func TestDisabledChannelIDs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Adding a new channel edge to the graph.
|
// Adding a new channel edge to the graph.
|
||||||
edgeInfo, edge1, edge2 := createChannelEdge(graph.db, node1, node2)
|
edgeInfo, edge1, edge2 := createChannelEdge(node1, node2)
|
||||||
if err := graph.AddLightningNode(node2); err != nil {
|
if err := graph.AddLightningNode(node2); err != nil {
|
||||||
t.Fatalf("unable to add node: %v", err)
|
t.Fatalf("unable to add node: %v", err)
|
||||||
}
|
}
|
||||||
@@ -3416,7 +3416,7 @@ func TestEdgePolicyMissingMaxHtcl(t *testing.T) {
|
|||||||
}
|
}
|
||||||
node2 := createTestVertex(t)
|
node2 := createTestVertex(t)
|
||||||
|
|
||||||
edgeInfo, edge1, edge2 := createChannelEdge(graph.db, node1, node2)
|
edgeInfo, edge1, edge2 := createChannelEdge(node1, node2)
|
||||||
if err := graph.AddLightningNode(node2); err != nil {
|
if err := graph.AddLightningNode(node2); err != nil {
|
||||||
t.Fatalf("unable to add node: %v", err)
|
t.Fatalf("unable to add node: %v", err)
|
||||||
}
|
}
|
||||||
@@ -3580,7 +3580,7 @@ func TestGraphZombieIndex(t *testing.T) {
|
|||||||
node1, node2 = node2, node1
|
node1, node2 = node2, node1
|
||||||
}
|
}
|
||||||
|
|
||||||
edge, _, _ := createChannelEdge(graph.db, node1, node2)
|
edge, _, _ := createChannelEdge(node1, node2)
|
||||||
require.NoError(t, graph.AddChannelEdge(edge))
|
require.NoError(t, graph.AddChannelEdge(edge))
|
||||||
|
|
||||||
// Since the edge is known the graph and it isn't a zombie, IsZombieEdge
|
// Since the edge is known the graph and it isn't a zombie, IsZombieEdge
|
||||||
@@ -3868,7 +3868,7 @@ func TestBatchedUpdateEdgePolicy(t *testing.T) {
|
|||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
|
|
||||||
// Create an edge and add it to the db.
|
// Create an edge and add it to the db.
|
||||||
edgeInfo, edge1, edge2 := createChannelEdge(graph.db, node1, node2)
|
edgeInfo, edge1, edge2 := createChannelEdge(node1, node2)
|
||||||
|
|
||||||
// Make sure inserting the policy at this point, before the edge info
|
// Make sure inserting the policy at this point, before the edge info
|
||||||
// is added, will fail.
|
// is added, will fail.
|
||||||
@@ -3979,7 +3979,7 @@ func TestGraphCacheForEachNodeChannel(t *testing.T) {
|
|||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
|
|
||||||
// Create an edge and add it to the db.
|
// Create an edge and add it to the db.
|
||||||
edgeInfo, e1, e2 := createChannelEdge(graph.db, node1, node2)
|
edgeInfo, e1, e2 := createChannelEdge(node1, node2)
|
||||||
|
|
||||||
// Because of lexigraphical sorting and the usage of random node keys in
|
// Because of lexigraphical sorting and the usage of random node keys in
|
||||||
// this test, we need to determine which edge belongs to node 1 at
|
// this test, we need to determine which edge belongs to node 1 at
|
||||||
|
Reference in New Issue
Block a user