Skip to content

Commit c3958a7

Browse files
committed
Update the CommitmentSigned message for Taproot support.
1 parent 482b96a commit c3958a7

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5923,6 +5923,8 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
59235923
channel_id: self.channel_id,
59245924
signature,
59255925
htlc_signatures,
5926+
#[cfg(taproot)]
5927+
partial_signature_with_nonce: None,
59265928
}, (counterparty_commitment_txid, commitment_stats.htlcs_included)))
59275929
}
59285930

lightning/src/ln/functional_tests.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,9 @@ fn test_update_fee_that_funder_cannot_afford() {
735735
let commit_signed_msg = msgs::CommitmentSigned {
736736
channel_id: chan.2,
737737
signature: res.0,
738-
htlc_signatures: res.1
738+
htlc_signatures: res.1,
739+
#[cfg(taproot)]
740+
partial_signature_with_nonce: None,
739741
};
740742

741743
let update_fee = msgs::UpdateFee {
@@ -1455,7 +1457,9 @@ fn test_fee_spike_violation_fails_htlc() {
14551457
let commit_signed_msg = msgs::CommitmentSigned {
14561458
channel_id: chan.2,
14571459
signature: res.0,
1458-
htlc_signatures: res.1
1460+
htlc_signatures: res.1,
1461+
#[cfg(taproot)]
1462+
partial_signature_with_nonce: None,
14591463
};
14601464

14611465
// Send the commitment_signed message to the nodes[1].

lightning/src/ln/msgs.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,9 @@ pub struct CommitmentSigned {
426426
pub signature: Signature,
427427
/// Signatures on the HTLC transactions
428428
pub htlc_signatures: Vec<Signature>,
429+
#[cfg(taproot)]
430+
/// The partial Taproot signature on the commitment transaction
431+
pub partial_signature_with_nonce: Option<PartialSignatureWithNonce>,
429432
}
430433

431434
/// A [`revoke_and_ack`] message to be sent to or received from a peer.
@@ -1402,12 +1405,22 @@ impl_writeable!(ClosingSignedFeeRange, {
14021405
max_fee_satoshis
14031406
});
14041407

1408+
#[cfg(not(taproot))]
14051409
impl_writeable_msg!(CommitmentSigned, {
14061410
channel_id,
14071411
signature,
14081412
htlc_signatures
14091413
}, {});
14101414

1415+
#[cfg(taproot)]
1416+
impl_writeable_msg!(CommitmentSigned, {
1417+
channel_id,
1418+
signature,
1419+
htlc_signatures
1420+
}, {
1421+
(2, partial_signature_with_nonce, option)
1422+
});
1423+
14111424
impl_writeable!(DecodedOnionErrorPacket, {
14121425
hmac,
14131426
failuremsg,
@@ -2713,6 +2726,8 @@ mod tests {
27132726
channel_id: [2; 32],
27142727
signature: sig_1,
27152728
htlc_signatures: if htlcs { vec![sig_2, sig_3, sig_4] } else { Vec::new() },
2729+
#[cfg(taproot)]
2730+
partial_signature_with_nonce: None,
27162731
};
27172732
let encoded_value = commitment_signed.encode();
27182733
let mut target_value = hex::decode("0202020202020202020202020202020202020202020202020202020202020202d977cb9b53d93a6ff64bb5f1e158b4094b66e798fb12911168a3ccdf80a83096340a6a95da0ae8d9f776528eecdbb747eb6b545495a4319ed5378e35b21e073a").unwrap();

0 commit comments

Comments
 (0)