From: Arik Sosman Date: Wed, 29 Mar 2023 22:02:34 +0000 (-0700) Subject: Update the `FundingSigned` message for Taproot support. X-Git-Tag: v0.0.115~40^2~3 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=5c79c8e2b83c2b24e08142f739a779acd0b3f57e;p=rust-lightning Update the `FundingSigned` message for Taproot support. --- diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index e413ab641..43604c191 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -2352,7 +2352,9 @@ impl Channel { Ok((msgs::FundingSigned { channel_id: self.channel_id, - signature + signature, + #[cfg(taproot)] + partial_signature_with_nonce: None, }, channel_monitor)) } diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index fa6c84f18..5e51fc0a9 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -284,6 +284,9 @@ pub struct FundingSigned { pub channel_id: [u8; 32], /// The signature of the channel acceptor (fundee) on the initial commitment transaction pub signature: Signature, + #[cfg(taproot)] + /// The partial signature of the channel acceptor (fundee) + pub partial_signature_with_nonce: Option, } /// A [`channel_ready`] message to be sent to or received from a peer. @@ -1429,11 +1432,20 @@ impl_writeable_msg!(FundingCreated, { (4, next_local_nonce, option) }); +#[cfg(not(taproot))] impl_writeable_msg!(FundingSigned, { channel_id, signature }, {}); +#[cfg(taproot)] +impl_writeable_msg!(FundingSigned, { + channel_id, + signature +}, { + (2, partial_signature_with_nonce, option) +}); + impl_writeable_msg!(ChannelReady, { channel_id, next_per_commitment_point, @@ -2536,6 +2548,8 @@ mod tests { let funding_signed = msgs::FundingSigned { channel_id: [2; 32], signature: sig_1, + #[cfg(taproot)] + partial_signature_with_nonce: None, }; let encoded_value = funding_signed.encode(); let target_value = hex::decode("0202020202020202020202020202020202020202020202020202020202020202d977cb9b53d93a6ff64bb5f1e158b4094b66e798fb12911168a3ccdf80a83096340a6a95da0ae8d9f776528eecdbb747eb6b545495a4319ed5378e35b21e073a").unwrap();