]> 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>
Wed, 18 Sep 2024 16:48:35 +0000 (16:48 +0000)
commit1c825e1f1898f8cfeda492f0335286a550380213
tree55985120e10d7d2623e394417f884e103d091a0e
parent04c46a5f3ab358b3bee69a064e75014f9e615612
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