]> 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>
Tue, 15 Oct 2024 15:43:40 +0000 (15:43 +0000)
commit71e6506c6ea6cec198165c7a7eaf0eeafa6e5fb8
tree774511e600962a6ebae1dfc27108abe4ffee2437
parent6f50308d33b756ae3b1be3e92a0180e294cf76b0
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