Skip to content

Commit 482b96a

Browse files
committed
Update the FundingSigned message for Taproot support.
1 parent 1fbeb11 commit 482b96a

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2352,7 +2352,9 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
23522352

23532353
Ok((msgs::FundingSigned {
23542354
channel_id: self.channel_id,
2355-
signature
2355+
signature,
2356+
#[cfg(taproot)]
2357+
partial_signature_with_nonce: None,
23562358
}, channel_monitor))
23572359
}
23582360

lightning/src/ln/msgs.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ pub struct FundingSigned {
284284
pub channel_id: [u8; 32],
285285
/// The signature of the channel acceptor (fundee) on the initial commitment transaction
286286
pub signature: Signature,
287+
#[cfg(taproot)]
288+
/// The partial signature of the channel acceptor (fundee)
289+
pub partial_signature_with_nonce: Option<PartialSignatureWithNonce>,
287290
}
288291

289292
/// A [`channel_ready`] message to be sent to or received from a peer.
@@ -1429,11 +1432,20 @@ impl_writeable_msg!(FundingCreated, {
14291432
(4, next_local_nonce, option)
14301433
});
14311434

1435+
#[cfg(not(taproot))]
14321436
impl_writeable_msg!(FundingSigned, {
14331437
channel_id,
14341438
signature
14351439
}, {});
14361440

1441+
#[cfg(taproot)]
1442+
impl_writeable_msg!(FundingSigned, {
1443+
channel_id,
1444+
signature
1445+
}, {
1446+
(2, partial_signature_with_nonce, option)
1447+
});
1448+
14371449
impl_writeable_msg!(ChannelReady, {
14381450
channel_id,
14391451
next_per_commitment_point,
@@ -2536,6 +2548,8 @@ mod tests {
25362548
let funding_signed = msgs::FundingSigned {
25372549
channel_id: [2; 32],
25382550
signature: sig_1,
2551+
#[cfg(taproot)]
2552+
partial_signature_with_nonce: None,
25392553
};
25402554
let encoded_value = funding_signed.encode();
25412555
let target_value = hex::decode("0202020202020202020202020202020202020202020202020202020202020202d977cb9b53d93a6ff64bb5f1e158b4094b66e798fb12911168a3ccdf80a83096340a6a95da0ae8d9f776528eecdbb747eb6b545495a4319ed5378e35b21e073a").unwrap();

lightning/src/sync/debug_sync.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ impl LockMetadata {
125125
}
126126

127127
fn pre_lock(this: &Arc<LockMetadata>, _double_lock_self_allowed: bool) {
128+
let stuff: RefCell<HashMap<u64, Arc<LockMetadata>>> = RefCell::new(HashMap::new());
129+
130+
128131
LOCKS_HELD.with(|held| {
129132
// For each lock which is currently locked, check that no lock's locked-before
130133
// set includes the lock we're about to lock, which would imply a lockorder

0 commit comments

Comments
 (0)