]> git.bitcoin.ninja Git - rust-lightning/commit
Clean up `PackageTemplate::get_height_timer` to consider type
authorMatt Corallo <git@bluematt.me>
Wed, 18 Sep 2024 16:00:20 +0000 (16:00 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 17 Oct 2024 18:34:33 +0000 (18:34 +0000)
commitbe915872c5d2d03fa45052c8567253d68303d222
treeab6057415b1ba8f780ab985c59307adf4ba8463f
parent303a0c9a4e59afb0583bb3835da992b484c843a6
Clean up `PackageTemplate::get_height_timer` to consider type

`PackageTemplate::get_height_timer` is used to decide when to next
bump our feerate on claims which need to make it on chain within
some window. It does so by comparing the current height with some
deadline and increasing the bump rate as the deadline approaches.

However, the deadline used is the `counterparty_spendable_height`,
which is the height at which the counterparty might be able to
spend the same output, irrespective of why. This doesn't make sense
for all output types, for example outbound HTLCs are spendable by
our counteraprty immediately (by revealing the preimage), but we
don't need to get our HTLC timeout claims confirmed immedaitely,
as we actually have `MIN_CLTV_EXPIRY` blocks before the inbound
edge of a forwarded HTLC becomes claimable by our (other)
counterparty.

Thus, here, we adapt `get_height_timer` to look at the type of
output being claimed, and adjust the rate at which we bump the fee
according to the real deadline.
lightning/src/chain/package.rs
lightning/src/ln/functional_tests.rs
lightning/src/ln/monitor_tests.rs
lightning/src/ln/reorg_tests.rs