@@ -70,7 +70,12 @@ fn test_open_channel() {
7070}
7171
7272#[ test]
73- fn test_async_commitment_signature_for_funding_created ( ) {
73+ fn test_funding_created ( ) {
74+ do_test_funding_created ( vec ! [ SignerOp :: SignCounterpartyCommitment , SignerOp :: GetPerCommitmentPoint ] ) ;
75+ do_test_funding_created ( vec ! [ SignerOp :: GetPerCommitmentPoint , SignerOp :: SignCounterpartyCommitment ] ) ;
76+ }
77+
78+ fn do_test_funding_created ( signer_ops : Vec < SignerOp > ) {
7479 // Simulate acquiring the signature for `funding_created` asynchronously.
7580 let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
7681 let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
@@ -91,7 +96,9 @@ fn test_async_commitment_signature_for_funding_created() {
9196 // But! Let's make node[0]'s signer be unavailable: we should *not* broadcast a funding_created
9297 // message...
9398 let ( temporary_channel_id, tx, _) = create_funding_transaction ( & nodes[ 0 ] , & nodes[ 1 ] . node . get_our_node_id ( ) , 100000 , 42 ) ;
94- nodes[ 0 ] . disable_channel_signer_op ( & nodes[ 1 ] . node . get_our_node_id ( ) , & temporary_channel_id, SignerOp :: SignCounterpartyCommitment ) ;
99+ for op in signer_ops. iter ( ) {
100+ nodes[ 0 ] . disable_channel_signer_op ( & nodes[ 1 ] . node . get_our_node_id ( ) , & temporary_channel_id, * op) ;
101+ }
95102 nodes[ 0 ] . node . funding_transaction_generated ( & temporary_channel_id, & nodes[ 1 ] . node . get_our_node_id ( ) , tx. clone ( ) ) . unwrap ( ) ;
96103 check_added_monitors ( & nodes[ 0 ] , 0 ) ;
97104
@@ -105,8 +112,10 @@ fn test_async_commitment_signature_for_funding_created() {
105112 channels[ 0 ] . channel_id
106113 } ;
107114
108- nodes[ 0 ] . enable_channel_signer_op ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, SignerOp :: SignCounterpartyCommitment ) ;
109- nodes[ 0 ] . node . signer_unblocked ( Some ( ( nodes[ 1 ] . node . get_our_node_id ( ) , chan_id) ) ) ;
115+ for op in signer_ops. iter ( ) {
116+ nodes[ 0 ] . enable_channel_signer_op ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, * op) ;
117+ nodes[ 0 ] . node . signer_unblocked ( Some ( ( nodes[ 1 ] . node . get_our_node_id ( ) , chan_id) ) ) ;
118+ }
110119
111120 let mut funding_created_msg = get_event_msg ! ( nodes[ 0 ] , MessageSendEvent :: SendFundingCreated , nodes[ 1 ] . node. get_our_node_id( ) ) ;
112121 nodes[ 1 ] . node . handle_funding_created ( & nodes[ 0 ] . node . get_our_node_id ( ) , & funding_created_msg) ;
@@ -121,7 +130,12 @@ fn test_async_commitment_signature_for_funding_created() {
121130}
122131
123132#[ test]
124- fn test_async_commitment_signature_for_funding_signed ( ) {
133+ fn test_funding_signed ( ) {
134+ do_test_funding_signed ( vec ! [ SignerOp :: SignCounterpartyCommitment , SignerOp :: GetPerCommitmentPoint ] ) ;
135+ do_test_funding_signed ( vec ! [ SignerOp :: GetPerCommitmentPoint , SignerOp :: SignCounterpartyCommitment ] ) ;
136+ }
137+
138+ fn do_test_funding_signed ( signer_ops : Vec < SignerOp > ) {
125139 // Simulate acquiring the signature for `funding_signed` asynchronously.
126140 let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
127141 let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
@@ -146,7 +160,9 @@ fn test_async_commitment_signature_for_funding_signed() {
146160
147161 // Now let's make node[1]'s signer be unavailable while handling the `funding_created`. It should
148162 // *not* broadcast a `funding_signed`...
149- nodes[ 1 ] . disable_channel_signer_op ( & nodes[ 0 ] . node . get_our_node_id ( ) , & temporary_channel_id, SignerOp :: SignCounterpartyCommitment ) ;
163+ for op in signer_ops. iter ( ) {
164+ nodes[ 1 ] . disable_channel_signer_op ( & nodes[ 0 ] . node . get_our_node_id ( ) , & temporary_channel_id, * op) ;
165+ }
150166 nodes[ 1 ] . node . handle_funding_created ( & nodes[ 0 ] . node . get_our_node_id ( ) , & funding_created_msg) ;
151167 check_added_monitors ( & nodes[ 1 ] , 1 ) ;
152168
@@ -159,8 +175,10 @@ fn test_async_commitment_signature_for_funding_signed() {
159175 assert_eq ! ( channels. len( ) , 1 , "expected one channel, not {}" , channels. len( ) ) ;
160176 channels[ 0 ] . channel_id
161177 } ;
162- nodes[ 1 ] . enable_channel_signer_op ( & nodes[ 0 ] . node . get_our_node_id ( ) , & chan_id, SignerOp :: SignCounterpartyCommitment ) ;
163- nodes[ 1 ] . node . signer_unblocked ( Some ( ( nodes[ 0 ] . node . get_our_node_id ( ) , chan_id) ) ) ;
178+ for op in signer_ops. iter ( ) {
179+ nodes[ 1 ] . enable_channel_signer_op ( & nodes[ 0 ] . node . get_our_node_id ( ) , & chan_id, * op) ;
180+ nodes[ 1 ] . node . signer_unblocked ( Some ( ( nodes[ 0 ] . node . get_our_node_id ( ) , chan_id) ) ) ;
181+ }
164182
165183 expect_channel_pending_event ( & nodes[ 1 ] , & nodes[ 0 ] . node . get_our_node_id ( ) ) ;
166184
@@ -220,7 +238,12 @@ fn test_async_commitment_signature_for_commitment_signed() {
220238}
221239
222240#[ test]
223- fn test_async_commitment_signature_for_funding_signed_0conf ( ) {
241+ fn test_funding_signed_0conf ( ) {
242+ do_test_funding_signed_0conf ( vec ! [ SignerOp :: SignCounterpartyCommitment , SignerOp :: SignCounterpartyCommitment ] ) ;
243+ do_test_funding_signed_0conf ( vec ! [ SignerOp :: SignCounterpartyCommitment , SignerOp :: GetPerCommitmentPoint ] ) ;
244+ }
245+
246+ fn do_test_funding_signed_0conf ( signer_ops : Vec < SignerOp > ) {
224247 // Simulate acquiring the signature for `funding_signed` asynchronously for a zero-conf channel.
225248 let mut manually_accept_config = test_default_channel_config ( ) ;
226249 manually_accept_config. manually_accept_inbound_channels = true ;
@@ -263,7 +286,9 @@ fn test_async_commitment_signature_for_funding_signed_0conf() {
263286
264287 // Now let's make node[1]'s signer be unavailable while handling the `funding_created`. It should
265288 // *not* broadcast a `funding_signed`...
266- nodes[ 1 ] . disable_channel_signer_op ( & nodes[ 0 ] . node . get_our_node_id ( ) , & temporary_channel_id, SignerOp :: SignCounterpartyCommitment ) ;
289+ for op in signer_ops. iter ( ) {
290+ nodes[ 1 ] . disable_channel_signer_op ( & nodes[ 0 ] . node . get_our_node_id ( ) , & temporary_channel_id, * op) ;
291+ }
267292 nodes[ 1 ] . node . handle_funding_created ( & nodes[ 0 ] . node . get_our_node_id ( ) , & funding_created_msg) ;
268293 check_added_monitors ( & nodes[ 1 ] , 1 ) ;
269294
@@ -278,8 +303,10 @@ fn test_async_commitment_signature_for_funding_signed_0conf() {
278303 } ;
279304
280305 // At this point, we basically expect the channel to open like a normal zero-conf channel.
281- nodes[ 1 ] . enable_channel_signer_op ( & nodes[ 0 ] . node . get_our_node_id ( ) , & chan_id, SignerOp :: SignCounterpartyCommitment ) ;
282- nodes[ 1 ] . node . signer_unblocked ( Some ( ( nodes[ 0 ] . node . get_our_node_id ( ) , chan_id) ) ) ;
306+ for op in signer_ops. iter ( ) {
307+ nodes[ 1 ] . enable_channel_signer_op ( & nodes[ 0 ] . node . get_our_node_id ( ) , & chan_id, * op) ;
308+ nodes[ 1 ] . node . signer_unblocked ( Some ( ( nodes[ 0 ] . node . get_our_node_id ( ) , chan_id) ) ) ;
309+ }
283310
284311 let ( funding_signed, channel_ready_1) = {
285312 let events = nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
0 commit comments