Skip to content

Commit

Permalink
Test async signing in V2 channel establishment
Browse files Browse the repository at this point in the history
  • Loading branch information
jkczyz committed Nov 15, 2024
1 parent 19018b3 commit c3f5063
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lightning/src/ln/dual_funding_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ use crate::ln::types::ChannelId;
use crate::prelude::*;
use crate::sign::{ChannelSigner as _, P2WPKH_WITNESS_WEIGHT};
use crate::util::ser::TransactionU16LenLimited;
#[cfg(async_signing)]
use crate::util::test_channel_signer::SignerOp;
use crate::util::test_utils;

// Dual-funding: V2 Channel Establishment Tests
Expand Down Expand Up @@ -129,9 +131,23 @@ fn do_test_v2_channel_establishment(
let _tx_complete_msg =
get_event_msg!(nodes[1], MessageSendEvent::SendTxComplete, nodes[0].node.get_our_node_id());

let tx_complete_msg = TxComplete { channel_id };
#[cfg(async_signing)] {
nodes[1].disable_channel_signer_op(
&nodes[0].node.get_our_node_id(), &channel_id, SignerOp::SignCounterpartyCommitment,
);
}

let tx_complete_msg = TxComplete { channel_id };
nodes[1].node.handle_tx_complete(nodes[0].node.get_our_node_id(), &tx_complete_msg);

#[cfg(async_signing)] {
assert!(nodes[1].node.get_and_clear_pending_msg_events().is_empty());
nodes[1].enable_channel_signer_op(
&nodes[0].node.get_our_node_id(), &channel_id, SignerOp::SignCounterpartyCommitment,
);
nodes[1].node.signer_unblocked(Some((nodes[0].node.get_our_node_id(), channel_id)));
}

let msg_events = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(msg_events.len(), 1);
let _msg_commitment_signed_from_1 = match msg_events[0] {
Expand Down

0 comments on commit c3f5063

Please sign in to comment.