mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 09:23:09 +02:00
routing/test: make test channel capacities configurable
This commit is contained in:
@@ -107,7 +107,7 @@ func onePathGraph(g *mockGraph) {
|
|||||||
g.addChannel(chanIm1Target, targetNodeID, im1NodeID, 100000)
|
g.addChannel(chanIm1Target, targetNodeID, im1NodeID, 100000)
|
||||||
}
|
}
|
||||||
|
|
||||||
func twoPathGraph(g *mockGraph) {
|
func twoPathGraph(g *mockGraph, capacityOut, capacityIn btcutil.Amount) {
|
||||||
// Create the following network of nodes:
|
// Create the following network of nodes:
|
||||||
// source -> intermediate1 -> target
|
// source -> intermediate1 -> target
|
||||||
// source -> intermediate2 -> target
|
// source -> intermediate2 -> target
|
||||||
@@ -120,10 +120,10 @@ func twoPathGraph(g *mockGraph) {
|
|||||||
intermediate2 := newMockNode(im2NodeID)
|
intermediate2 := newMockNode(im2NodeID)
|
||||||
g.addNode(intermediate2)
|
g.addNode(intermediate2)
|
||||||
|
|
||||||
g.addChannel(chanSourceIm1, sourceNodeID, im1NodeID, 200000)
|
g.addChannel(chanSourceIm1, sourceNodeID, im1NodeID, capacityOut)
|
||||||
g.addChannel(chanSourceIm2, sourceNodeID, im2NodeID, 200000)
|
g.addChannel(chanSourceIm2, sourceNodeID, im2NodeID, capacityOut)
|
||||||
g.addChannel(chanIm1Target, targetNodeID, im1NodeID, 100000)
|
g.addChannel(chanIm1Target, targetNodeID, im1NodeID, capacityIn)
|
||||||
g.addChannel(chanIm2Target, targetNodeID, im2NodeID, 100000)
|
g.addChannel(chanIm2Target, targetNodeID, im2NodeID, capacityIn)
|
||||||
}
|
}
|
||||||
|
|
||||||
var mppTestCases = []mppSendTestCase{
|
var mppTestCases = []mppSendTestCase{
|
||||||
@@ -137,7 +137,9 @@ var mppTestCases = []mppSendTestCase{
|
|||||||
{
|
{
|
||||||
|
|
||||||
name: "sufficient inbound",
|
name: "sufficient inbound",
|
||||||
graph: twoPathGraph,
|
graph: func(g *mockGraph) {
|
||||||
|
twoPathGraph(g, 200000, 100000)
|
||||||
|
},
|
||||||
amt: 70000,
|
amt: 70000,
|
||||||
expectedAttempts: 5,
|
expectedAttempts: 5,
|
||||||
expectedSuccesses: []expectedHtlcSuccess{
|
expectedSuccesses: []expectedHtlcSuccess{
|
||||||
@@ -156,7 +158,9 @@ var mppTestCases = []mppSendTestCase{
|
|||||||
// Test that a cap on the max htlcs makes it impossible to pay.
|
// Test that a cap on the max htlcs makes it impossible to pay.
|
||||||
{
|
{
|
||||||
name: "no splitting",
|
name: "no splitting",
|
||||||
graph: twoPathGraph,
|
graph: func(g *mockGraph) {
|
||||||
|
twoPathGraph(g, 200000, 100000)
|
||||||
|
},
|
||||||
amt: 70000,
|
amt: 70000,
|
||||||
expectedAttempts: 2,
|
expectedAttempts: 2,
|
||||||
expectedSuccesses: []expectedHtlcSuccess{},
|
expectedSuccesses: []expectedHtlcSuccess{},
|
||||||
|
Reference in New Issue
Block a user