Avoid retrying over recently failed channels
authorJeffrey Czyz <jkczyz@gmail.com>
Thu, 31 Mar 2022 02:20:58 +0000 (21:20 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Fri, 1 Apr 2022 20:52:10 +0000 (15:52 -0500)
commit5337f89d8bbb8dd3ade0e7bdcfca899c7b3941a9
tree9be1886a82f609e18a5f5e31bb14ce6597fc08ea
parent7671ae54522197dbca495c4c7b3fec5c814a1841
Avoid retrying over recently failed channels

In ProbabilisticScorer, the channel liquidity balance is reduced
whenever a payment fails at the corresponding channel. The payment may
still be retried through the channel, however, because the liquidity
penalty is capped. Use u64::max_value instead in this situation to avoid
retrying over the same path. This effectively makes u64::max_value the
penalty for amounts exceeding the upper bound, as well.

As an edge case, avoid using u64::max_value on attempts where the amount
is equal to the effective capacity, which may be the HTLC maximum when
the channel capacity is unknown.
lightning/src/routing/scoring.rs