Skip to content

Commit 5aae0ab

Browse files
committed
Exclude HTLC transactions from broadcast on anchor channels
HTLC transactions from anchor channels are constrained by a CSV of 1 block, so broadcasting them along with the unconfirmed commitment tranasction will result in them being immediately rejected as premature.
1 parent 62236c7 commit 5aae0ab

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,6 +2653,11 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
26532653
let commitment_tx = self.onchain_tx_handler.get_fully_signed_holder_tx(&self.funding_redeemscript);
26542654
let txid = commitment_tx.txid();
26552655
let mut holder_transactions = vec![commitment_tx];
2656+
// When anchor outputs are present, the HTLC transactions are only valid once the commitment
2657+
// transaction confirms.
2658+
if self.onchain_tx_handler.opt_anchors() {
2659+
return holder_transactions;
2660+
}
26562661
for htlc in self.current_holder_commitment_tx.htlc_outputs.iter() {
26572662
if let Some(vout) = htlc.0.transaction_output_index {
26582663
let preimage = if !htlc.0.offered {
@@ -2686,6 +2691,11 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
26862691
let commitment_tx = self.onchain_tx_handler.get_fully_signed_copy_holder_tx(&self.funding_redeemscript);
26872692
let txid = commitment_tx.txid();
26882693
let mut holder_transactions = vec![commitment_tx];
2694+
// When anchor outputs are present, the HTLC transactions are only final once the commitment
2695+
// transaction confirms due to the CSV 1 encumberance.
2696+
if self.onchain_tx_handler.opt_anchors() {
2697+
return holder_transactions;
2698+
}
26892699
for htlc in self.current_holder_commitment_tx.htlc_outputs.iter() {
26902700
if let Some(vout) = htlc.0.transaction_output_index {
26912701
let preimage = if !htlc.0.offered {

0 commit comments

Comments
 (0)