Skip to content

Commit 1fbeb11

Browse files
committed
Update the FundingCreated message for Taproot support.
1 parent b56223b commit 1fbeb11

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5398,7 +5398,11 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
53985398
temporary_channel_id,
53995399
funding_txid: funding_txo.txid,
54005400
funding_output_index: funding_txo.index,
5401-
signature
5401+
signature,
5402+
#[cfg(taproot)]
5403+
partial_signature_with_nonce: None,
5404+
#[cfg(taproot)]
5405+
next_local_nonce: None,
54025406
})
54035407
}
54045408

lightning/src/ln/msgs.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ pub struct FundingCreated {
267267
pub funding_output_index: u16,
268268
/// The signature of the channel initiator (funder) on the initial commitment transaction
269269
pub signature: Signature,
270+
#[cfg(taproot)]
271+
/// The partial signature of the channel initiator (funder)
272+
pub partial_signature_with_nonce: Option<PartialSignatureWithNonce>,
273+
#[cfg(taproot)]
274+
/// Next nonce the channel acceptor should use to finalize the funding output signature
275+
pub next_local_nonce: Option<musig2::types::PublicNonce>
270276
}
271277

272278
/// A [`funding_signed`] message to be sent to or received from a peer.
@@ -1405,12 +1411,23 @@ impl_writeable!(DecodedOnionErrorPacket, {
14051411
pad
14061412
});
14071413

1414+
#[cfg(not(taproot))]
14081415
impl_writeable_msg!(FundingCreated, {
14091416
temporary_channel_id,
14101417
funding_txid,
14111418
funding_output_index,
14121419
signature
14131420
}, {});
1421+
#[cfg(taproot)]
1422+
impl_writeable_msg!(FundingCreated, {
1423+
temporary_channel_id,
1424+
funding_txid,
1425+
funding_output_index,
1426+
signature
1427+
}, {
1428+
(2, partial_signature_with_nonce, option),
1429+
(4, next_local_nonce, option)
1430+
});
14141431

14151432
impl_writeable_msg!(FundingSigned, {
14161433
channel_id,
@@ -2501,6 +2518,10 @@ mod tests {
25012518
funding_txid: Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap(),
25022519
funding_output_index: 255,
25032520
signature: sig_1,
2521+
#[cfg(taproot)]
2522+
partial_signature_with_nonce: None,
2523+
#[cfg(taproot)]
2524+
next_local_nonce: None,
25042525
};
25052526
let encoded_value = funding_created.encode();
25062527
let target_value = hex::decode("02020202020202020202020202020202020202020202020202020202020202026e96fe9f8b0ddcd729ba03cfafa5a27b050b39d354dd980814268dfa9a44d4c200ffd977cb9b53d93a6ff64bb5f1e158b4094b66e798fb12911168a3ccdf80a83096340a6a95da0ae8d9f776528eecdbb747eb6b545495a4319ed5378e35b21e073a").unwrap();

0 commit comments

Comments
 (0)