routing/result_interpretation: fix off-by-one for incoming failure

Previously we would not mark a success for the first hop if the fail
source index was 2. We also add a test to assert this behavior.
This commit is contained in:
Conner Fromknecht
2019-10-30 21:18:52 -07:00
parent 64e5d06cd1
commit 2f8021d8db
2 changed files with 31 additions and 2 deletions

View File

@ -265,7 +265,7 @@ func (i *interpretedResult) processPaymentOutcomeIntermediate(
// All nodes up to the failing pair must have forwarded
// successfully.
if errorSourceIdx > 2 {
if errorSourceIdx > 1 {
i.successPairRange(route, 0, errorSourceIdx-2)
}
}