From 110c99f67699f433d3ad885fd3ffe04c3dc5492b Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Wed, 25 Mar 2020 16:21:58 +0100 Subject: [PATCH] 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. --- routing/result_interpretation.go | 17 +++-------------- routing/result_interpretation_test.go | 10 ++++++---- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/routing/result_interpretation.go b/routing/result_interpretation.go index 660ce69c..70cc08f6 100644 --- a/routing/result_interpretation.go +++ b/routing/result_interpretation.go @@ -215,20 +215,9 @@ func (i *interpretedResult) processPaymentOutcomeFinal( 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) + // Assign all pairs a success result, as the payment reached the + // destination correctly. Continue the payment process. + i.successPairRange(route, 0, n-1) default: // All other errors are considered terminal if coming from the diff --git a/routing/result_interpretation_test.go b/routing/result_interpretation_test.go index 537869f0..2fc0a7d9 100644 --- a/routing/result_interpretation_test.go +++ b/routing/result_interpretation_test.go @@ -325,8 +325,10 @@ var resultTestCases = []resultTestCase{ failure: &lnwire.FailMPPTimeout{}, expectedResult: &interpretedResult{ - finalFailureReason: &reasonError, - nodeFailure: nil, + pairResults: map[DirectedNodePair]pairResult{ + getTestPair(0, 1): successPairResult(100), + }, + nodeFailure: nil, }, }, @@ -342,9 +344,9 @@ var resultTestCases = []resultTestCase{ expectedResult: &interpretedResult{ pairResults: map[DirectedNodePair]pairResult{ getTestPair(0, 1): successPairResult(100), + getTestPair(1, 2): successPairResult(99), }, - finalFailureReason: &reasonError, - nodeFailure: nil, + nodeFailure: nil, }, }, }