+ let mut expected_next_node = expected_route.last().unwrap().node.get_our_node_id();
+ macro_rules! get_next_msgs {
+ ($node: expr) => {
+ {
+ let events = $node.node.get_and_clear_pending_msg_events();
+ assert_eq!(events.len(), 1);
+ match events[0] {
+ MessageSendEvent::UpdateHTLCs { ref node_id, updates: msgs::CommitmentUpdate { ref update_add_htlcs, ref update_fulfill_htlcs, ref update_fail_htlcs, ref update_fail_malformed_htlcs, ref update_fee, ref commitment_signed } } => {
+ assert!(update_add_htlcs.is_empty());
+ assert_eq!(update_fulfill_htlcs.len(), 1);
+ assert!(update_fail_htlcs.is_empty());
+ assert!(update_fail_malformed_htlcs.is_empty());
+ assert!(update_fee.is_none());
+ expected_next_node = node_id.clone();
+ Some((update_fulfill_htlcs[0].clone(), commitment_signed.clone()))
+ },
+ _ => panic!("Unexpected event"),
+ }
+ }
+ }
+ }
+
+ macro_rules! last_update_fulfill_dance {
+ ($node: expr, $prev_node: expr) => {
+ {
+ $node.node.handle_update_fulfill_htlc(&$prev_node.node.get_our_node_id(), &next_msgs.as_ref().unwrap().0).unwrap();
+ check_added_monitors!($node, 0);
+ assert!($node.node.get_and_clear_pending_msg_events().is_empty());
+ commitment_signed_dance!($node, $prev_node, next_msgs.as_ref().unwrap().1, false);
+ }
+ }
+ }
+ macro_rules! mid_update_fulfill_dance {
+ ($node: expr, $prev_node: expr, $new_msgs: expr) => {