routing: continue trying after mpp timeout

It can happen that the receiver times out some htlcs of the set if it
took to long to complete. But because the sender's mission control is
now updated, it is worth to keep trying to send those shards again.
This commit is contained in:
Joost Jager 2020-03-25 16:21:58 +01:00
parent f5c3f930c4
commit 110c99f676
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7
2 changed files with 9 additions and 18 deletions

View File

@ -215,20 +215,9 @@ func (i *interpretedResult) processPaymentOutcomeFinal(
i.finalFailureReason = &reasonIncorrectDetails i.finalFailureReason = &reasonIncorrectDetails
case *lnwire.FailMPPTimeout: case *lnwire.FailMPPTimeout:
// TODO(carla): decide how to penalize mpp timeout. In the // Assign all pairs a success result, as the payment reached the
// meantime, attribute success to the hops along the route and // destination correctly. Continue the payment process.
// do not penalize the final node. i.successPairRange(route, 0, n-1)
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: default:
// All other errors are considered terminal if coming from the // All other errors are considered terminal if coming from the

View File

@ -325,8 +325,10 @@ var resultTestCases = []resultTestCase{
failure: &lnwire.FailMPPTimeout{}, failure: &lnwire.FailMPPTimeout{},
expectedResult: &interpretedResult{ expectedResult: &interpretedResult{
finalFailureReason: &reasonError, pairResults: map[DirectedNodePair]pairResult{
nodeFailure: nil, getTestPair(0, 1): successPairResult(100),
},
nodeFailure: nil,
}, },
}, },
@ -342,9 +344,9 @@ var resultTestCases = []resultTestCase{
expectedResult: &interpretedResult{ expectedResult: &interpretedResult{
pairResults: map[DirectedNodePair]pairResult{ pairResults: map[DirectedNodePair]pairResult{
getTestPair(0, 1): successPairResult(100), getTestPair(0, 1): successPairResult(100),
getTestPair(1, 2): successPairResult(99),
}, },
finalFailureReason: &reasonError, nodeFailure: nil,
nodeFailure: nil,
}, },
}, },
} }