Track "steady-state" channel balances in history buckets not live
authorMatt Corallo <git@bluematt.me>
Sun, 16 Apr 2023 04:03:08 +0000 (04:03 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 15 Sep 2023 17:20:38 +0000 (17:20 +0000)
commit2ed21b87faee83946bfd77d3c01c5c1e6fd7d7e9
treecb7a974a26ec7e430f8f33823ee56ba06ed83596
parentda127d3f5f87f10c1b61c7d487b0a52334fa6614
Track "steady-state" channel balances in history buckets not live

The lower-bound of the scoring history buckets generally never get
used - if we try to send a payment and it fails, we don't learn
a new lower-bound for the liquidity of a channel, and if we
successfully send a payment we only learn a lower-bound that
applied *before* we sent the payment, not after it completed.

If we assume channels have some "steady-state" liquidity, then
tracking our liquidity estimates *after* a payment doesn't really
make sense - we're not super likely to make a second payment across
the same channel immediately (or, if we are, we can use our
un-decayed liquidity estimates for that). By the time we do go to
use the same channel again, we'd assume that its back at its
"steady-state" and the impacts of our payment have been lost.

To combat both of these effects, here we "subtract" the impact of
any just-successful payments from our liquidity estimates prior to
updating the historical buckets.
lightning/src/routing/scoring.rs