Track historical liquidity update time separately from the bounds
authorMatt Corallo <git@bluematt.me>
Mon, 2 Oct 2023 19:44:36 +0000 (19:44 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 13 Dec 2023 23:26:09 +0000 (23:26 +0000)
commitf0f8194719158759b9d745df7f136312fb09ff13
treed29d28b26839498a2ee6e5f75407155eedfe6585
parentb84842a9048dcfc1d8d21e1db73e1961b4b175b0
Track historical liquidity update time separately from the bounds

In the next commit, we'll start to use the new
`ScoreUpdate::decay_liquidity_certainty` to decay our bounds in the
background. This will result in the `last_updated` field getting
updated regularly on decay, rather than only on update. While this
isn't an issue for the regular liquidity bounds, it poses a problem
for the historical liquidity buckets, which are decayed on a
separate (and by default much longer) timer. If we didn't move to
tracking their decays separately, we'd never let the `last_updated`
field get old enough for the historical buckets to decay at all.

Instead, here we introduce a new `Duration` in the
`ChannelLiquidity` which tracks the last time the historical
liquidity buckets were last updated. We initialize it to a copy of
`last_updated` on deserialization if it is missing.
lightning/src/routing/scoring.rs