Skip to content

Commit 1aa4ae1

Browse files
committed
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 them to implement a small shim over their wallet/UTXO source, that grants 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.
1 parent 32da8df commit 1aa4ae1

9 files changed

+488
-63
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ use crate::util::ser::{Readable, ReadableArgs, RequiredWrapper, MaybeReadable, U
5353
use crate::util::byte_utils;
5454
use crate::events::Event;
5555
#[cfg(anchors)]
56-
use crate::events::{AnchorDescriptor, HTLCDescriptor, BumpTransactionEvent};
56+
use crate::events::bump_transaction::{AnchorDescriptor, HTLCDescriptor, BumpTransactionEvent};
5757

5858
use crate::prelude::*;
5959
use core::{cmp, mem};

lightning/src/chain/keysinterface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use crate::util::crypto::{hkdf_extract_expand_twice, sign};
3636
use crate::util::ser::{Writeable, Writer, Readable};
3737
use crate::chain::transaction::OutPoint;
3838
#[cfg(anchors)]
39-
use crate::events::HTLCDescriptor;
39+
use crate::events::bump_transaction::HTLCDescriptor;
4040
use crate::ln::channel::ANCHOR_OUTPUT_VALUE_SATOSHI;
4141
use crate::ln::{chan_utils, PaymentPreimage};
4242
use crate::ln::chan_utils::{HTLCOutputInCommitment, make_funding_redeemscript, ChannelPublicKeys, HolderCommitmentTransaction, ChannelTransactionParameters, CommitmentTransaction, ClosingTransaction};

0 commit comments

Comments
 (0)