Skip to content

Commit d2d16a6

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 c71334e commit d2d16a6

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
@@ -6164,9 +6164,9 @@ where
61646164
}
61656165
}
61666166

6167-
fn get_initial_counterparty_commitment_signature<L: Deref>(
6167+
fn get_initial_counterparty_commitment_signatures<L: Deref>(
61686168
&self, funding: &FundingScope, logger: &L,
6169-
) -> Option<Signature>
6169+
) -> Option<(Signature, Vec<Signature>)>
61706170
where
61716171
SP::Target: SignerProvider,
61726172
L::Target: Logger,
@@ -6201,7 +6201,6 @@ where
62016201
Vec::new(),
62026202
&self.secp_ctx,
62036203
)
6204-
.map(|(signature, _)| signature)
62056204
.ok()
62066205
},
62076206
// TODO (taproot|arik)
@@ -6219,16 +6218,20 @@ where
62196218
{
62206219
debug_assert!(self.interactive_tx_signing_session.is_some());
62216220

6222-
let signature = self.get_initial_counterparty_commitment_signature(funding, logger);
6223-
if let Some(signature) = signature {
6221+
let signatures = self.get_initial_counterparty_commitment_signatures(funding, logger);
6222+
if let Some((signature, htlc_signatures)) = signatures {
62246223
log_info!(
62256224
logger,
62266225
"Generated commitment_signed for peer for channel {}",
62276226
&self.channel_id()
62286227
);
6228+
if matches!(self.channel_state, ChannelState::FundingNegotiated(_)) {
6229+
// We shouldn't expect any HTLCs before `ChannelReady`.
6230+
debug_assert!(htlc_signatures.is_empty());
6231+
}
62296232
Some(msgs::CommitmentSigned {
62306233
channel_id: self.channel_id,
6231-
htlc_signatures: vec![],
6234+
htlc_signatures,
62326235
signature,
62336236
funding_txid: funding.get_funding_txo().map(|funding_txo| funding_txo.txid),
62346237
#[cfg(taproot)]

0 commit comments

Comments
 (0)