@@ -41,11 +41,7 @@ fn test_async_commitment_signature_for_funding_created() {
4141 nodes[ 0 ] . node . funding_transaction_generated ( & temporary_channel_id, & nodes[ 1 ] . node . get_our_node_id ( ) , tx. clone ( ) ) . unwrap ( ) ;
4242 check_added_monitors ( & nodes[ 0 ] , 0 ) ;
4343
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( ) ) ;
4945
5046 // Now re-enable the signer and simulate a retry. The temporary_channel_id won't work anymore so
5147 // we have to dig out the real channel ID.
@@ -100,11 +96,7 @@ fn test_async_commitment_signature_for_funding_signed() {
10096 nodes[ 1 ] . node . handle_funding_created ( & nodes[ 0 ] . node . get_our_node_id ( ) , & funding_created_msg) ;
10197 check_added_monitors ( & nodes[ 1 ] , 1 ) ;
10298
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( ) ) ;
108100
109101 // Now re-enable the signer and simulate a retry. The temporary_channel_id won't work anymore so
110102 // we have to dig out the real channel ID.
@@ -137,8 +129,7 @@ fn test_async_commitment_signature_for_commitment_signed() {
137129 let per_peer_state = nodes[ 0 ] . node . per_peer_state . read ( ) . unwrap ( ) ;
138130 let chan_lock = per_peer_state. get ( & nodes[ 1 ] . node . get_our_node_id ( ) ) . unwrap ( ) . lock ( ) . unwrap ( ) ;
139131 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( ) ) ;
142133 * chan_ids[ 0 ]
143134 } ;
144135
@@ -174,8 +165,7 @@ fn test_async_commitment_signature_for_commitment_signed() {
174165 dst. node . signer_unblocked ( Some ( ( src. node . get_our_node_id ( ) , chan_id) ) ) ;
175166
176167 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( ) ) ;
179169 if let MessageSendEvent :: UpdateHTLCs { ref node_id, .. } = events[ 0 ] {
180170 assert_eq ! ( node_id, & src. node. get_our_node_id( ) ) ;
181171 } else {
@@ -231,11 +221,7 @@ fn test_async_commitment_signature_for_funding_signed_0conf() {
231221 nodes[ 1 ] . node . handle_funding_created ( & nodes[ 0 ] . node . get_our_node_id ( ) , & funding_created_msg) ;
232222 check_added_monitors ( & nodes[ 1 ] , 1 ) ;
233223
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( ) ) ;
239225
240226 // Now re-enable the signer and simulate a retry. The temporary_channel_id won't work anymore so
241227 // we have to dig out the real channel ID.
@@ -298,8 +284,7 @@ fn test_async_commitment_signature_for_peer_disconnect() {
298284 let per_peer_state = nodes[ 0 ] . node . per_peer_state . read ( ) . unwrap ( ) ;
299285 let chan_lock = per_peer_state. get ( & nodes[ 1 ] . node . get_our_node_id ( ) ) . unwrap ( ) . lock ( ) . unwrap ( ) ;
300286 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( ) ) ;
303288 * chan_ids[ 0 ]
304289 } ;
305290
@@ -344,8 +329,7 @@ fn test_async_commitment_signature_for_peer_disconnect() {
344329
345330 {
346331 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( ) ) ;
349333 if let MessageSendEvent :: UpdateHTLCs { ref node_id, .. } = events[ 0 ] {
350334 assert_eq ! ( node_id, & src. node. get_our_node_id( ) ) ;
351335 } else {
0 commit comments