Builder for creating static invoices from offers
[rust-lightning] / lightning / src / ln / blinded_payment_tests.rs
index d4570ef8c5de8e65c42ec73288cfd8962b7af0c2..c1d65fd1a118f2f3e669950d2e2ed2db8b4cf97e 100644 (file)
@@ -180,7 +180,9 @@ fn mpp_to_one_hop_blinded_path() {
        let ev = remove_first_msg_event_to_node(&nodes[2].node.get_our_node_id(), &mut events);
        pass_along_path(&nodes[0], expected_route[1], amt_msat, payment_hash.clone(),
                Some(payment_secret), ev.clone(), true, None);
-       claim_payment_along_route(&nodes[0], expected_route, false, payment_preimage);
+       claim_payment_along_route(
+               ClaimAlongRouteArgs::new(&nodes[0], expected_route, payment_preimage)
+       );
 }
 
 #[test]
@@ -244,7 +246,9 @@ fn mpp_to_three_hop_blinded_paths() {
        let ev = remove_first_msg_event_to_node(&nodes[2].node.get_our_node_id(), &mut events);
        pass_along_path(&nodes[0], expected_route[1], amt_msat, payment_hash.clone(),
                Some(payment_secret), ev.clone(), true, None);
-       claim_payment_along_route(&nodes[0], expected_route, false, payment_preimage);
+       claim_payment_along_route(
+               ClaimAlongRouteArgs::new(&nodes[0], expected_route, payment_preimage)
+       );
 }
 
 enum ForwardCheckFail {
@@ -462,6 +466,7 @@ fn do_forward_fail_in_process_pending_htlc_fwds(check: ProcessPendingHTLCsCheck,
                (chan.0.contents, chan.2)
        };
 
+       let error_message = "Channel force-closed";
        let amt_msat = 5000;
        let (_, payment_hash, payment_secret) = get_payment_preimage_hash(&nodes[2], Some(amt_msat), None);
        let route_params = get_blinded_route_parameters(amt_msat, payment_secret, 1, 1_0000_0000,
@@ -494,7 +499,7 @@ fn do_forward_fail_in_process_pending_htlc_fwds(check: ProcessPendingHTLCsCheck,
                                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();
+                                       $curr_node.node.force_close_broadcasting_latest_txn(&$failed_chan_id, &$next_node.node.get_our_node_id(), error_message.to_string()).unwrap();
                                        let events = $curr_node.node.get_and_clear_pending_events();
                                        match events[0] {
                                                crate::events::Event::PendingHTLCsForwardable { .. } => {},
@@ -1219,7 +1224,9 @@ fn blinded_keysend() {
 
        let ev = remove_first_msg_event_to_node(&nodes[1].node.get_our_node_id(), &mut events);
        pass_along_path(&nodes[0], expected_route[0], amt_msat, payment_hash, Some(payment_secret), ev.clone(), true, Some(keysend_preimage));
-       claim_payment_along_route(&nodes[0], expected_route, false, keysend_preimage);
+       claim_payment_along_route(
+               ClaimAlongRouteArgs::new(&nodes[0], expected_route, keysend_preimage)
+       );
 }
 
 #[test]
@@ -1270,7 +1277,9 @@ fn blinded_mpp_keysend() {
        let ev = remove_first_msg_event_to_node(&nodes[2].node.get_our_node_id(), &mut events);
        pass_along_path(&nodes[0], expected_route[1], amt_msat, payment_hash.clone(),
                Some(payment_secret), ev.clone(), true, Some(keysend_preimage));
-       claim_payment_along_route(&nodes[0], expected_route, false, keysend_preimage);
+       claim_payment_along_route(
+               ClaimAlongRouteArgs::new(&nodes[0], expected_route, keysend_preimage)
+       );
 }
 
 #[test]
@@ -1318,5 +1327,8 @@ fn custom_tlvs_to_blinded_path() {
                .with_payment_secret(payment_secret)
                .with_custom_tlvs(recipient_onion_fields.custom_tlvs.clone());
        do_pass_along_path(args);
-       claim_payment(&nodes[0], &[&nodes[1]], payment_preimage);
+       claim_payment_along_route(
+               ClaimAlongRouteArgs::new(&nodes[0], &[&[&nodes[1]]], payment_preimage)
+                       .with_custom_tlvs(recipient_onion_fields.custom_tlvs.clone())
+       );
 }