Pass pending_events into pay_internal
[rust-lightning] / lightning / src / ln / chanmon_update_fail_tests.rs
index 385f5b5353ca5f697880c441061de805cfbc2d28..fdb66cc4dc8224d6c95b4abd57bdeaf24983509a 100644 (file)
@@ -935,7 +935,7 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
 
        // Note that the ordering of the events for different nodes is non-prescriptive, though the
        // ordering of the two events that both go to nodes[2] have to stay in the same order.
-       let (nodes_0_event, events_3) = remove_first_msg_event_to_node(&nodes[0].node.get_our_node_id(), &events_3);
+       let nodes_0_event = remove_first_msg_event_to_node(&nodes[0].node.get_our_node_id(), &mut events_3);
        let messages_a = match nodes_0_event {
                MessageSendEvent::UpdateHTLCs { node_id, mut updates } => {
                        assert_eq!(node_id, nodes[0].node.get_our_node_id());
@@ -949,12 +949,12 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
                _ => panic!("Unexpected event type!"),
        };
 
-       let (nodes_2_event, events_3) = remove_first_msg_event_to_node(&nodes[2].node.get_our_node_id(), &events_3);
+       let nodes_2_event = remove_first_msg_event_to_node(&nodes[2].node.get_our_node_id(), &mut events_3);
        let send_event_b = SendEvent::from_event(nodes_2_event);
        assert_eq!(send_event_b.node_id, nodes[2].node.get_our_node_id());
 
        let raa = if test_ignore_second_cs {
-               let (nodes_2_event, _events_3) = remove_first_msg_event_to_node(&nodes[2].node.get_our_node_id(), &events_3);
+               let nodes_2_event = remove_first_msg_event_to_node(&nodes[2].node.get_our_node_id(), &mut events_3);
                match nodes_2_event {
                        MessageSendEvent::SendRevokeAndACK { node_id, msg } => {
                                assert_eq!(node_id, nodes[2].node.get_our_node_id());
@@ -1752,12 +1752,18 @@ fn test_monitor_update_on_pending_forwards() {
        commitment_signed_dance!(nodes[0], nodes[1], bs_updates.commitment_signed, false, true);
 
        let events = nodes[0].node.get_and_clear_pending_events();
-       assert_eq!(events.len(), 2);
+       assert_eq!(events.len(), 3);
        if let Event::PaymentPathFailed { payment_hash, payment_failed_permanently, .. } = events[0] {
                assert_eq!(payment_hash, payment_hash_1);
                assert!(payment_failed_permanently);
        } else { panic!("Unexpected event!"); }
        match events[1] {
+               Event::PaymentFailed { payment_hash, .. } => {
+                       assert_eq!(payment_hash, payment_hash_1);
+               },
+               _ => panic!("Unexpected event"),
+       }
+       match events[2] {
                Event::PendingHTLCsForwardable { .. } => { },
                _ => panic!("Unexpected event"),
        };