Add BumpTransaction event handler
authorWilmer Paulino <wilmer@wilmerpaulino.com>
Thu, 27 Apr 2023 00:42:35 +0000 (17:42 -0700)
committerWilmer Paulino <wilmer@wilmerpaulino.com>
Mon, 19 Jun 2023 21:05:45 +0000 (14:05 -0700)
commitd4b6f8c08e6eceaa13a531acdb7161b85337f3cc
treeafccbba392ff6cc0314408ff2b23d225c2ef1fe3
parentd5cbc6c261db73f1712512be50b82114eae76f62
Add BumpTransaction event handler

This allows users to bump their commitments and HTLC transactions
without having to worry about all the little details to do so. Instead,
we'll just require that they implement the `CoinSelectionSource` trait
over their wallet/UTXO source, granting the event handler permission to
spend confirmed UTXOs for the transactions it'll produce.

While the event handler should in most cases produce valid transactions,
assuming the provided confirmed UTXOs are valid, it may not produce
relayable transactions due to not satisfying certain Replace-By-Fee
(RBF) mempool policy requirements. Some of these require that the
replacement transactions have a higher feerate and absolute fee than the
conflicting transactions it aims to replace. To make sure we adhere to
these requirements, we'd have to persist some state for all transactions
the event handler has produced, greatly increasing its complexity. While
we may consider implementing so in the future, we choose to go with a
simple initial version that relies on the OnchainTxHandler's bumping
frequency. For each new bumping attempt, the OnchainTxHandler proposes a
25% feerate increase to ensure transactions can propagate under
constrained mempool circumstances.
lightning/src/events/bump_transaction.rs
lightning/src/events/mod.rs
lightning/src/ln/chan_utils.rs