@@ -1232,24 +1232,23 @@ macro_rules! check_warn_msg {
1232
1232
1233
1233
/// Check that a channel's closing channel update has been broadcasted, and optionally
1234
1234
/// check whether an error message event has occurred.
1235
- pub fn check_closed_broadcast ( node : & Node , with_error_msg : bool ) -> Option < msgs:: ErrorMessage > {
1235
+ pub fn check_closed_broadcast ( node : & Node , num_channels : usize , with_error_msg : bool ) -> Vec < msgs:: ErrorMessage > {
1236
1236
let msg_events = node. node . get_and_clear_pending_msg_events ( ) ;
1237
- assert_eq ! ( msg_events. len( ) , if with_error_msg { 2 } else { 1 } ) ;
1238
- match msg_events[ 0 ] {
1239
- MessageSendEvent :: BroadcastChannelUpdate { ref msg } => {
1240
- assert_eq ! ( msg. contents. flags & 2 , 2 ) ;
1241
- } ,
1242
- _ => panic ! ( "Unexpected event" ) ,
1243
- }
1244
- if with_error_msg {
1245
- match msg_events[ 1 ] {
1237
+ assert_eq ! ( msg_events. len( ) , if with_error_msg { num_channels * 2 } else { num_channels } ) ;
1238
+ msg_events. into_iter ( ) . filter_map ( |msg_event| {
1239
+ match msg_event {
1240
+ MessageSendEvent :: BroadcastChannelUpdate { ref msg } => {
1241
+ assert_eq ! ( msg. contents. flags & 2 , 2 ) ;
1242
+ None
1243
+ } ,
1246
1244
MessageSendEvent :: HandleError { action : msgs:: ErrorAction :: SendErrorMessage { ref msg } , node_id : _ } => {
1245
+ assert ! ( with_error_msg) ;
1247
1246
// TODO: Check node_id
1248
1247
Some ( msg. clone ( ) )
1249
1248
} ,
1250
1249
_ => panic ! ( "Unexpected event" ) ,
1251
1250
}
1252
- } else { None }
1251
+ } ) . collect ( )
1253
1252
}
1254
1253
1255
1254
/// Check that a channel's closing channel update has been broadcasted, and optionally
@@ -1259,7 +1258,7 @@ pub fn check_closed_broadcast(node: &Node, with_error_msg: bool) -> Option<msgs:
1259
1258
#[ macro_export]
1260
1259
macro_rules! check_closed_broadcast {
1261
1260
( $node: expr, $with_error_msg: expr) => {
1262
- $crate:: ln:: functional_test_utils:: check_closed_broadcast( & $node, $with_error_msg)
1261
+ $crate:: ln:: functional_test_utils:: check_closed_broadcast( & $node, 1 , $with_error_msg) . pop ( )
1263
1262
}
1264
1263
}
1265
1264
0 commit comments