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>
Sat, 9 Dec 2023 00:53:48 +0000 (00:53 +0000)
commitab057c19ff7557099f1df1204d6164f85ea3ab0c
tree5b1fdc8ffddffa3bc89c8f2f01e580887d612713
parent4ccd7f6d7a8dfc57c0cdb2c3f9c51943152429a3
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