Include excess commitment transaction fees in dust exposure
authorMatt Corallo <git@bluematt.me>
Tue, 30 Apr 2024 20:42:36 +0000 (20:42 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 7 May 2024 14:13:55 +0000 (14:13 +0000)
commit51bf78d604b28fe189171e1b976fe87cbb2614b7
tree57831e7df77b4fecca6819b77df31726ffd233ab
parent11c3d7001ba54e1c8641566ca05dd58571f29c55
Include excess commitment transaction fees in dust exposure

Transaction fees on counterparty commitment transactions are
ultimately not our money and thus are really "dust" from our PoV -
they're funds that may be ours during off-chain updates but are not
ours once we go on-chain.

Thus, here, we count any such fees in excess of our own fee
estimates towards dust exposure. We don't bother to make an
inbound/outbound channel distinction here as in most cases users
will use `MaxDustExposure::FeeRateMultiplier` which will scale
with the fee we set on outbound channels anyway.

Note that this also enables the dust exposure checks on anchor
channels during feerate updates. We'd previously elided these as
increases in the channel feerates do not change the HTLC dust
exposure, but now do for the fee dust exposure.
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_tests.rs