- match check {
- ProcessPendingHTLCsCheck::FwdPeerDisconnected => {
- // Disconnect the next-hop peer so when we go to forward in process_pending_htlc_forwards, the
- // intro node will error backwards.
- nodes[1].node.peer_disconnected(&nodes[2].node.get_our_node_id());
- expect_pending_htlcs_forwardable!(nodes[1]);
- expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!(nodes[1],
- vec![HTLCDestination::NextHopChannel { node_id: Some(nodes[2].node.get_our_node_id()), channel_id }]);
- },
- ProcessPendingHTLCsCheck::FwdChannelClosed => {
- // Force close the next-hop channel so when we go to forward in process_pending_htlc_forwards,
- // the intro node will error backwards.
- nodes[1].node.force_close_broadcasting_latest_txn(&channel_id, &nodes[2].node.get_our_node_id()).unwrap();
- let events = nodes[1].node.get_and_clear_pending_events();
- match events[0] {
- crate::events::Event::PendingHTLCsForwardable { .. } => {},
- _ => panic!("Unexpected event {:?}", events),
- };
- match events[1] {
- crate::events::Event::ChannelClosed { .. } => {},
- _ => panic!("Unexpected event {:?}", events),
- }
+ macro_rules! cause_error {
+ ($prev_node: expr, $curr_node: expr, $next_node: expr, $failed_chan_id: expr, $failed_scid: expr) => {
+ match check {
+ ProcessPendingHTLCsCheck::FwdPeerDisconnected => {
+ // Disconnect the next-hop peer so when we go to forward in process_pending_htlc_forwards, the
+ // intro node will error backwards.
+ $curr_node.node.peer_disconnected(&$next_node.node.get_our_node_id());
+ expect_pending_htlcs_forwardable!($curr_node);
+ expect_pending_htlcs_forwardable_and_htlc_handling_failed_ignore!($curr_node,
+ vec![HTLCDestination::NextHopChannel { node_id: Some($next_node.node.get_our_node_id()), channel_id: $failed_chan_id }]);
+ },
+ ProcessPendingHTLCsCheck::FwdChannelClosed => {
+ // Force close the next-hop channel so when we go to forward in process_pending_htlc_forwards,
+ // the intro node will error backwards.
+ $curr_node.node.force_close_broadcasting_latest_txn(&$failed_chan_id, &$next_node.node.get_our_node_id()).unwrap();
+ let events = $curr_node.node.get_and_clear_pending_events();
+ match events[0] {
+ crate::events::Event::PendingHTLCsForwardable { .. } => {},
+ _ => panic!("Unexpected event {:?}", events),
+ };
+ match events[1] {
+ crate::events::Event::ChannelClosed { .. } => {},
+ _ => panic!("Unexpected event {:?}", events),
+ }