+
+ let count = expected_failures.len() + 1;
+ assert_eq!(events.len(), count);
+
+ if expected_failures.len() > 0 {
+ expect_htlc_handling_failed_destinations!(events, expected_failures)
+ }
+ }}
+}
+
+#[macro_export]
+macro_rules! expect_htlc_handling_failed_destinations {
+ ($events: expr, $expected_failures: expr) => {{
+ for event in $events {
+ match event {
+ $crate::util::events::Event::PendingHTLCsForwardable { .. } => { },
+ $crate::util::events::Event::HTLCHandlingFailed { ref failed_next_destination, .. } => {
+ assert!($expected_failures.contains(&failed_next_destination))
+ },
+ _ => panic!("Unexpected destination"),
+ }
+ }