@@ -41,11 +41,7 @@ fn test_async_commitment_signature_for_funding_created() {
41
41
nodes[ 0 ] . node . funding_transaction_generated ( & temporary_channel_id, & nodes[ 1 ] . node . get_our_node_id ( ) , tx. clone ( ) ) . unwrap ( ) ;
42
42
check_added_monitors ( & nodes[ 0 ] , 0 ) ;
43
43
44
- {
45
- let events = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
46
- let n = events. len ( ) ;
47
- assert_eq ! ( n, 0 , "expected no events generated from nodes[0], found {}" , n) ;
48
- }
44
+ assert ! ( nodes[ 0 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
49
45
50
46
// Now re-enable the signer and simulate a retry. The temporary_channel_id won't work anymore so
51
47
// we have to dig out the real channel ID.
@@ -100,11 +96,7 @@ fn test_async_commitment_signature_for_funding_signed() {
100
96
nodes[ 1 ] . node . handle_funding_created ( & nodes[ 0 ] . node . get_our_node_id ( ) , & funding_created_msg) ;
101
97
check_added_monitors ( & nodes[ 1 ] , 1 ) ;
102
98
103
- {
104
- let events = nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
105
- let n = events. len ( ) ;
106
- assert_eq ! ( n, 0 , "expected no events generated from nodes[1], found {}" , n) ;
107
- }
99
+ assert ! ( nodes[ 1 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
108
100
109
101
// Now re-enable the signer and simulate a retry. The temporary_channel_id won't work anymore so
110
102
// we have to dig out the real channel ID.
@@ -137,8 +129,7 @@ fn test_async_commitment_signature_for_commitment_signed() {
137
129
let per_peer_state = nodes[ 0 ] . node . per_peer_state . read ( ) . unwrap ( ) ;
138
130
let chan_lock = per_peer_state. get ( & nodes[ 1 ] . node . get_our_node_id ( ) ) . unwrap ( ) . lock ( ) . unwrap ( ) ;
139
131
let chan_ids = chan_lock. channel_by_id . keys ( ) . collect :: < Vec < _ > > ( ) ;
140
- let n = chan_ids. len ( ) ;
141
- assert_eq ! ( n, 1 , "expected one channel, not {}" , n) ;
132
+ assert_eq ! ( chan_ids. len( ) , 1 , "expected one channel, not {}" , chan_ids. len( ) ) ;
142
133
* chan_ids[ 0 ]
143
134
} ;
144
135
@@ -174,8 +165,7 @@ fn test_async_commitment_signature_for_commitment_signed() {
174
165
dst. node . signer_unblocked ( Some ( ( src. node . get_our_node_id ( ) , chan_id) ) ) ;
175
166
176
167
let events = dst. node . get_and_clear_pending_msg_events ( ) ;
177
- let n = events. len ( ) ;
178
- assert_eq ! ( n, 1 , "expected one message, got {}" , n) ;
168
+ assert_eq ! ( events. len( ) , 1 , "expected one message, got {}" , events. len( ) ) ;
179
169
if let MessageSendEvent :: UpdateHTLCs { ref node_id, .. } = events[ 0 ] {
180
170
assert_eq ! ( node_id, & src. node. get_our_node_id( ) ) ;
181
171
} else {
@@ -231,11 +221,7 @@ fn test_async_commitment_signature_for_funding_signed_0conf() {
231
221
nodes[ 1 ] . node . handle_funding_created ( & nodes[ 0 ] . node . get_our_node_id ( ) , & funding_created_msg) ;
232
222
check_added_monitors ( & nodes[ 1 ] , 1 ) ;
233
223
234
- {
235
- let events = nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
236
- let n = events. len ( ) ;
237
- assert_eq ! ( n, 0 , "expected no events generated from nodes[1], found {}" , n) ;
238
- }
224
+ assert ! ( nodes[ 1 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
239
225
240
226
// Now re-enable the signer and simulate a retry. The temporary_channel_id won't work anymore so
241
227
// we have to dig out the real channel ID.
@@ -298,8 +284,7 @@ fn test_async_commitment_signature_for_peer_disconnect() {
298
284
let per_peer_state = nodes[ 0 ] . node . per_peer_state . read ( ) . unwrap ( ) ;
299
285
let chan_lock = per_peer_state. get ( & nodes[ 1 ] . node . get_our_node_id ( ) ) . unwrap ( ) . lock ( ) . unwrap ( ) ;
300
286
let chan_ids = chan_lock. channel_by_id . keys ( ) . collect :: < Vec < _ > > ( ) ;
301
- let n = chan_ids. len ( ) ;
302
- assert_eq ! ( n, 1 , "expected one channel, not {}" , n) ;
287
+ assert_eq ! ( chan_ids. len( ) , 1 , "expected one channel, not {}" , chan_ids. len( ) ) ;
303
288
* chan_ids[ 0 ]
304
289
} ;
305
290
@@ -344,8 +329,7 @@ fn test_async_commitment_signature_for_peer_disconnect() {
344
329
345
330
{
346
331
let events = dst. node . get_and_clear_pending_msg_events ( ) ;
347
- let n = events. len ( ) ;
348
- assert_eq ! ( n, 1 , "expected one message, got {}" , n) ;
332
+ assert_eq ! ( events. len( ) , 1 , "expected one message, got {}" , events. len( ) ) ;
349
333
if let MessageSendEvent :: UpdateHTLCs { ref node_id, .. } = events[ 0 ] {
350
334
assert_eq ! ( node_id, & src. node. get_our_node_id( ) ) ;
351
335
} else {
0 commit comments