Skip to content

Commit cc2dc2e

Browse files
committed
Include HTLC signatures in initial commitment signed for splices
While we did consider the pending HTLCs when generating the signatures, we did not include them in the resulting `commitment_signed` message sent because we assumed it was only used within a dual-funding context where there are no pending HTLCs.
1 parent 5a84daf commit cc2dc2e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lightning/src/ln/channel.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6115,9 +6115,9 @@ where
61156115
}
61166116
}
61176117

6118-
fn get_initial_counterparty_commitment_signature<L: Deref>(
6118+
fn get_initial_counterparty_commitment_signatures<L: Deref>(
61196119
&self, funding: &FundingScope, logger: &L,
6120-
) -> Option<Signature>
6120+
) -> Option<(Signature, Vec<Signature>)>
61216121
where
61226122
SP::Target: SignerProvider,
61236123
L::Target: Logger,
@@ -6152,7 +6152,6 @@ where
61526152
Vec::new(),
61536153
&self.secp_ctx,
61546154
)
6155-
.map(|(signature, _)| signature)
61566155
.ok()
61576156
},
61586157
// TODO (taproot|arik)
@@ -6170,16 +6169,20 @@ where
61706169
{
61716170
debug_assert!(self.interactive_tx_signing_session.is_some());
61726171

6173-
let signature = self.get_initial_counterparty_commitment_signature(funding, logger);
6174-
if let Some(signature) = signature {
6172+
let signatures = self.get_initial_counterparty_commitment_signatures(funding, logger);
6173+
if let Some((signature, htlc_signatures)) = signatures {
61756174
log_info!(
61766175
logger,
61776176
"Generated commitment_signed for peer for channel {}",
61786177
&self.channel_id()
61796178
);
6179+
if matches!(self.channel_state, ChannelState::FundingNegotiated(_)) {
6180+
// We shouldn't expect any HTLCs before `ChannelReady`.
6181+
debug_assert!(htlc_signatures.is_empty());
6182+
}
61806183
Some(msgs::CommitmentSigned {
61816184
channel_id: self.channel_id,
6182-
htlc_signatures: vec![],
6185+
htlc_signatures,
61836186
signature,
61846187
funding_txid: funding.get_funding_txo().map(|funding_txo| funding_txo.txid),
61856188
#[cfg(taproot)]

0 commit comments

Comments
 (0)