Skip to content

Commit 1671d75

Browse files
committed
Do not produce 0FC HTLC txs on unsafe_get_latest_holder_commitment_txn
As in CSV anchor channels, HTLC transactions in 0FC channels require external funding before they can be finalized, so we choose to return the commitment transaction alone here.
1 parent 49ffdcf commit 1671d75

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5131,9 +5131,22 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
51315131
self.funding.current_holder_commitment_tx.add_holder_sig(&redeem_script, sig)
51325132
};
51335133
let mut holder_transactions = vec![commitment_tx];
5134-
// When anchor outputs are present, the HTLC transactions are only final once the commitment
5135-
// transaction confirms due to the CSV 1 encumberance.
5136-
if self.channel_type_features().supports_anchors_zero_fee_htlc_tx() {
5134+
5135+
if self.channel_type_features().supports_anchors_zero_fee_htlc_tx()
5136+
|| self.channel_type_features().supports_anchor_zero_fee_commitments()
5137+
{
5138+
// HTLC transactions in these channels require external funding before finalized,
5139+
// so we return the commitment transaction alone here.
5140+
//
5141+
// In 0FC channels, we *could* use HTLC transactions to pay for fees on a
5142+
// 0FC commitment transaction to save the fixed transaction overhead
5143+
// (locktime + version), but we would still have to pay for fees using
5144+
// external UTXOs to avoid invalidating the counterparty HTLC signature.
5145+
// This is something we would consider in the future.
5146+
//
5147+
// Furthermore, we can't broadcast a HTLC claim transaction while the
5148+
// anchor claim transaction and its parent are still unconfirmed due to the
5149+
// current single-child restriction on TRUC transactions.
51375150
return holder_transactions;
51385151
}
51395152

0 commit comments

Comments
 (0)