mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-08 05:08:13 +02:00
routing/test: test local unified edge
This commit is contained in:
@@ -18,10 +18,15 @@ func TestNodeEdgeUnifier(t *testing.T) {
|
|||||||
source := route.Vertex{1}
|
source := route.Vertex{1}
|
||||||
toNode := route.Vertex{2}
|
toNode := route.Vertex{2}
|
||||||
fromNode := route.Vertex{3}
|
fromNode := route.Vertex{3}
|
||||||
bandwidthHints := &mockBandwidthHints{}
|
bandwidthHints := &mockBandwidthHints{
|
||||||
|
hints: map[uint64]lnwire.MilliSatoshi{
|
||||||
|
100: 150,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
// Add two channels between the pair of nodes.
|
// Add two channels between the pair of nodes.
|
||||||
p1 := models.CachedEdgePolicy{
|
p1 := models.CachedEdgePolicy{
|
||||||
|
ChannelID: 100,
|
||||||
FeeProportionalMillionths: 100000,
|
FeeProportionalMillionths: 100000,
|
||||||
FeeBaseMSat: 30,
|
FeeBaseMSat: 30,
|
||||||
TimeLockDelta: 60,
|
TimeLockDelta: 60,
|
||||||
@@ -30,6 +35,7 @@ func TestNodeEdgeUnifier(t *testing.T) {
|
|||||||
MinHTLC: 100,
|
MinHTLC: 100,
|
||||||
}
|
}
|
||||||
p2 := models.CachedEdgePolicy{
|
p2 := models.CachedEdgePolicy{
|
||||||
|
ChannelID: 101,
|
||||||
FeeProportionalMillionths: 190000,
|
FeeProportionalMillionths: 190000,
|
||||||
FeeBaseMSat: 10,
|
FeeBaseMSat: 10,
|
||||||
TimeLockDelta: 40,
|
TimeLockDelta: 40,
|
||||||
@@ -53,6 +59,9 @@ func TestNodeEdgeUnifier(t *testing.T) {
|
|||||||
fromNode, &models.CachedEdgePolicy{}, 0, defaultHopPayloadSize,
|
fromNode, &models.CachedEdgePolicy{}, 0, defaultHopPayloadSize,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
unifierLocal := newNodeEdgeUnifier(fromNode, toNode, nil)
|
||||||
|
unifierLocal.addPolicy(fromNode, &p1, c1, defaultHopPayloadSize)
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
unifier *nodeEdgeUnifier
|
unifier *nodeEdgeUnifier
|
||||||
@@ -116,6 +125,21 @@ func TestNodeEdgeUnifier(t *testing.T) {
|
|||||||
unifier: unifierNoInfo,
|
unifier: unifierNoInfo,
|
||||||
expectedCapacity: 0,
|
expectedCapacity: 0,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "local insufficient bandwidth",
|
||||||
|
unifier: unifierLocal,
|
||||||
|
amount: 200,
|
||||||
|
expectNoPolicy: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "local",
|
||||||
|
unifier: unifierLocal,
|
||||||
|
amount: 100,
|
||||||
|
expectedFeeBase: p1.FeeBaseMSat,
|
||||||
|
expectedFeeRate: p1.FeeProportionalMillionths,
|
||||||
|
expectedTimeLock: p1.TimeLockDelta,
|
||||||
|
expectedCapacity: c1,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
Reference in New Issue
Block a user