routing: interpret mpp timeout failues
This commit adds success mission control results for all hops along the route in a mpp timeout and takes no action for the final hop along the route. This is a temporary measure to prevent the default logic from penalizing the final node while we decide how to penalize mpp timeouts.
This commit is contained in:
parent
b6f546503a
commit
25a8773736
@ -216,6 +216,22 @@ func (i *interpretedResult) processPaymentOutcomeFinal(
|
||||
// deliberately. What to penalize?
|
||||
i.finalFailureReason = &reasonIncorrectDetails
|
||||
|
||||
case *lnwire.FailMPPTimeout:
|
||||
// TODO(carla): decide how to penalize mpp timeout. In the
|
||||
// meantime, attribute success to the hops along the route and
|
||||
// do not penalize the final node.
|
||||
|
||||
i.finalFailureReason = &reasonError
|
||||
|
||||
// If this is a direct payment, take no action.
|
||||
if n == 1 {
|
||||
return
|
||||
}
|
||||
|
||||
// Assign all pairs a success result except the final hop, as
|
||||
// the payment reached the destination correctly.
|
||||
i.successPairRange(route, 0, n-2)
|
||||
|
||||
default:
|
||||
// All other errors are considered terminal if coming from the
|
||||
// final hop. They indicate that something is wrong at the
|
||||
|
@ -272,6 +272,39 @@ var resultTestCases = []resultTestCase{
|
||||
nodeFailure: &hops[1],
|
||||
},
|
||||
},
|
||||
|
||||
// Tests a single hop mpp timeout. Test that final node is not
|
||||
// penalized. This is a temporary measure while we decide how to
|
||||
// penalize mpp timeouts.
|
||||
{
|
||||
name: "one hop mpp timeout",
|
||||
route: &routeOneHop,
|
||||
failureSrcIdx: 1,
|
||||
failure: &lnwire.FailMPPTimeout{},
|
||||
|
||||
expectedResult: &interpretedResult{
|
||||
finalFailureReason: &reasonError,
|
||||
nodeFailure: nil,
|
||||
},
|
||||
},
|
||||
|
||||
// Tests a two hop mpp timeout. Test that final node is not penalized
|
||||
// and the intermediate hop is attributed the success. This is a
|
||||
// temporary measure while we decide how to penalize mpp timeouts.
|
||||
{
|
||||
name: "two hop mpp timeout",
|
||||
route: &routeTwoHop,
|
||||
failureSrcIdx: 2,
|
||||
failure: &lnwire.FailMPPTimeout{},
|
||||
|
||||
expectedResult: &interpretedResult{
|
||||
pairResults: map[DirectedNodePair]pairResult{
|
||||
getTestPair(0, 1): successPairResult(100),
|
||||
},
|
||||
finalFailureReason: &reasonError,
|
||||
nodeFailure: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// TestResultInterpretation executes a list of test cases that test the result
|
||||
|
Loading…
Reference in New Issue
Block a user