@@ -70,7 +70,12 @@ fn test_open_channel() {
70
70
}
71
71
72
72
#[ 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 > ) {
74
79
// Simulate acquiring the signature for `funding_created` asynchronously.
75
80
let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
76
81
let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
@@ -91,7 +96,9 @@ fn test_async_commitment_signature_for_funding_created() {
91
96
// But! Let's make node[0]'s signer be unavailable: we should *not* broadcast a funding_created
92
97
// message...
93
98
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
+ }
95
102
nodes[ 0 ] . node . funding_transaction_generated ( & temporary_channel_id, & nodes[ 1 ] . node . get_our_node_id ( ) , tx. clone ( ) ) . unwrap ( ) ;
96
103
check_added_monitors ( & nodes[ 0 ] , 0 ) ;
97
104
@@ -105,8 +112,10 @@ fn test_async_commitment_signature_for_funding_created() {
105
112
channels[ 0 ] . channel_id
106
113
} ;
107
114
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
+ }
110
119
111
120
let mut funding_created_msg = get_event_msg ! ( nodes[ 0 ] , MessageSendEvent :: SendFundingCreated , nodes[ 1 ] . node. get_our_node_id( ) ) ;
112
121
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() {
121
130
}
122
131
123
132
#[ 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 > ) {
125
139
// Simulate acquiring the signature for `funding_signed` asynchronously.
126
140
let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
127
141
let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
@@ -146,7 +160,9 @@ fn test_async_commitment_signature_for_funding_signed() {
146
160
147
161
// Now let's make node[1]'s signer be unavailable while handling the `funding_created`. It should
148
162
// *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
+ }
150
166
nodes[ 1 ] . node . handle_funding_created ( & nodes[ 0 ] . node . get_our_node_id ( ) , & funding_created_msg) ;
151
167
check_added_monitors ( & nodes[ 1 ] , 1 ) ;
152
168
@@ -159,8 +175,10 @@ fn test_async_commitment_signature_for_funding_signed() {
159
175
assert_eq ! ( channels. len( ) , 1 , "expected one channel, not {}" , channels. len( ) ) ;
160
176
channels[ 0 ] . channel_id
161
177
} ;
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
+ }
164
182
165
183
expect_channel_pending_event ( & nodes[ 1 ] , & nodes[ 0 ] . node . get_our_node_id ( ) ) ;
166
184
@@ -220,7 +238,12 @@ fn test_async_commitment_signature_for_commitment_signed() {
220
238
}
221
239
222
240
#[ 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 > ) {
224
247
// Simulate acquiring the signature for `funding_signed` asynchronously for a zero-conf channel.
225
248
let mut manually_accept_config = test_default_channel_config ( ) ;
226
249
manually_accept_config. manually_accept_inbound_channels = true ;
@@ -263,7 +286,9 @@ fn test_async_commitment_signature_for_funding_signed_0conf() {
263
286
264
287
// Now let's make node[1]'s signer be unavailable while handling the `funding_created`. It should
265
288
// *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
+ }
267
292
nodes[ 1 ] . node . handle_funding_created ( & nodes[ 0 ] . node . get_our_node_id ( ) , & funding_created_msg) ;
268
293
check_added_monitors ( & nodes[ 1 ] , 1 ) ;
269
294
@@ -278,8 +303,10 @@ fn test_async_commitment_signature_for_funding_signed_0conf() {
278
303
} ;
279
304
280
305
// 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
+ }
283
310
284
311
let ( funding_signed, channel_ready_1) = {
285
312
let events = nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
0 commit comments