mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-12 07:08:24 +01:00
routing: bugfix for mc reporting of blinded paths
When reporting an error or a success case of a payment to a blinded paths, the amounts to forward for intermediate hops are set to 0 so we need to use the receiver amount instead.
This commit is contained in:
@@ -96,13 +96,17 @@ var (
|
||||
AmtToForward: 99,
|
||||
},
|
||||
{
|
||||
PubKeyBytes: hops[2],
|
||||
AmtToForward: 95,
|
||||
PubKeyBytes: hops[2],
|
||||
// Intermediate blinded hops don't have an
|
||||
// amount set.
|
||||
AmtToForward: 0,
|
||||
BlindingPoint: genTestPubKey(),
|
||||
},
|
||||
{
|
||||
PubKeyBytes: hops[3],
|
||||
AmtToForward: 88,
|
||||
PubKeyBytes: hops[3],
|
||||
// Intermediate blinded hops don't have an
|
||||
// amount set.
|
||||
AmtToForward: 0,
|
||||
},
|
||||
{
|
||||
PubKeyBytes: hops[4],
|
||||
@@ -122,8 +126,10 @@ var (
|
||||
AmtToForward: 99,
|
||||
},
|
||||
{
|
||||
PubKeyBytes: hops[2],
|
||||
AmtToForward: 95,
|
||||
PubKeyBytes: hops[2],
|
||||
// Intermediate blinded hops don't have an
|
||||
// amount set.
|
||||
AmtToForward: 0,
|
||||
BlindingPoint: genTestPubKey(),
|
||||
},
|
||||
{
|
||||
@@ -140,13 +146,17 @@ var (
|
||||
TotalAmount: 100,
|
||||
Hops: []*route.Hop{
|
||||
{
|
||||
PubKeyBytes: hops[1],
|
||||
AmtToForward: 90,
|
||||
PubKeyBytes: hops[1],
|
||||
// Intermediate blinded hops don't have an
|
||||
// amount set.
|
||||
AmtToForward: 0,
|
||||
BlindingPoint: genTestPubKey(),
|
||||
},
|
||||
{
|
||||
PubKeyBytes: hops[2],
|
||||
AmtToForward: 75,
|
||||
PubKeyBytes: hops[2],
|
||||
// Intermediate blinded hops don't have an
|
||||
// amount set.
|
||||
AmtToForward: 0,
|
||||
},
|
||||
{
|
||||
PubKeyBytes: hops[3],
|
||||
@@ -552,7 +562,12 @@ var resultTestCases = []resultTestCase{
|
||||
pairResults: map[DirectedNodePair]pairResult{
|
||||
getTestPair(0, 1): successPairResult(100),
|
||||
getTestPair(1, 2): successPairResult(99),
|
||||
getTestPair(3, 4): failPairResult(88),
|
||||
|
||||
// The amount for the last hop is always the
|
||||
// receiver amount because the amount to forward
|
||||
// is always set to 0 for intermediate blinded
|
||||
// hops.
|
||||
getTestPair(3, 4): failPairResult(77),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -567,7 +582,12 @@ var resultTestCases = []resultTestCase{
|
||||
expectedResult: &interpretedResult{
|
||||
pairResults: map[DirectedNodePair]pairResult{
|
||||
getTestPair(0, 1): successPairResult(100),
|
||||
getTestPair(2, 3): failPairResult(75),
|
||||
|
||||
// The amount for the last hop is always the
|
||||
// receiver amount because the amount to forward
|
||||
// is always set to 0 for intermediate blinded
|
||||
// hops.
|
||||
getTestPair(2, 3): failPairResult(58),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -682,6 +702,25 @@ var resultTestCases = []resultTestCase{
|
||||
finalFailureReason: &reasonError,
|
||||
},
|
||||
},
|
||||
// Test a multi-hop blinded route and that in a success case the amounts
|
||||
// for the blinded route part are correctly set to the receiver amount.
|
||||
{
|
||||
name: "blinded multi-hop success",
|
||||
route: blindedMultiToIntroduction,
|
||||
success: true,
|
||||
expectedResult: &interpretedResult{
|
||||
pairResults: map[DirectedNodePair]pairResult{
|
||||
getTestPair(0, 1): successPairResult(100),
|
||||
|
||||
// For the route blinded part of the route the
|
||||
// success amount is determined by the receiver
|
||||
// amount because the intermediate blinded hops
|
||||
// set the forwarded amount to 0.
|
||||
getTestPair(1, 2): successPairResult(58),
|
||||
getTestPair(2, 3): successPairResult(58),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// TestResultInterpretation executes a list of test cases that test the result
|
||||
|
||||
Reference in New Issue
Block a user