mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-09 06:54:32 +02:00
routing: fix gap in result interpretation
Fixes an off by one error that skipped assigning a success pair. Added a test that previously failed because of this bug.
This commit is contained in:
@ -191,10 +191,8 @@ func (i *interpretedResult) processPaymentOutcomeFinal(
|
||||
i.failPair(route, n-1)
|
||||
|
||||
// The other hops relayed corectly, so assign those pairs a
|
||||
// success result.
|
||||
if n > 2 {
|
||||
i.successPairRange(route, 0, n-2)
|
||||
}
|
||||
// success result. At this point, n >= 2.
|
||||
i.successPairRange(route, 0, n-2)
|
||||
|
||||
// We are using wrong payment hash or amount, fail the payment.
|
||||
case *lnwire.FailIncorrectPaymentAmount,
|
||||
@ -223,7 +221,7 @@ func (i *interpretedResult) processPaymentOutcomeFinal(
|
||||
i.failNode(route, n)
|
||||
|
||||
// Other channels in the route forwarded correctly.
|
||||
if n > 2 {
|
||||
if n >= 2 {
|
||||
i.successPairRange(route, 0, n-2)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user