Skip to content

Commit 7691397

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 2323b89 commit 7691397

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
@@ -2622,6 +2622,11 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
26222622
let commitment_tx = self.onchain_tx_handler.get_fully_signed_holder_tx(&self.funding_redeemscript);
26232623
let txid = commitment_tx.txid();
26242624
let mut holder_transactions = vec![commitment_tx];
2625+
// When anchor outputs are present, the HTLC transactions are only valid once the commitment
2626+
// transaction confirms.
2627+
if self.onchain_tx_handler.opt_anchors() {
2628+
return holder_transactions;
2629+
}
26252630
for htlc in self.current_holder_commitment_tx.htlc_outputs.iter() {
26262631
if let Some(vout) = htlc.0.transaction_output_index {
26272632
let preimage = if !htlc.0.offered {
@@ -2655,6 +2660,11 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
26552660
let commitment_tx = self.onchain_tx_handler.get_fully_signed_copy_holder_tx(&self.funding_redeemscript);
26562661
let txid = commitment_tx.txid();
26572662
let mut holder_transactions = vec![commitment_tx];
2663+
// When anchor outputs are present, the HTLC transactions are only valid once the commitment
2664+
// transaction confirms.
2665+
if self.onchain_tx_handler.opt_anchors() {
2666+
return holder_transactions;
2667+
}
26582668
for htlc in self.current_holder_commitment_tx.htlc_outputs.iter() {
26592669
if let Some(vout) = htlc.0.transaction_output_index {
26602670
let preimage = if !htlc.0.offered {

0 commit comments

Comments
 (0)