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]
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 {
let amt_msat = 5000;
let (_, payment_hash, payment_secret) = get_payment_preimage_hash(&nodes[3], Some(amt_msat), None);
- let route_params = get_blinded_route_parameters(amt_msat, payment_secret, 1, 1_0000_0000,
+ let mut route_params = get_blinded_route_parameters(amt_msat, payment_secret, 1, 1_0000_0000,
nodes.iter().skip(1).map(|n| n.node.get_our_node_id()).collect(),
&[&chan_upd_1_2, &chan_upd_2_3], &chanmon_cfgs[3].keys_manager);
+ route_params.payment_params.max_path_length = 18;
let route = get_route(&nodes[0], &route_params).unwrap();
node_cfgs[0].router.expect_find_route(route_params.clone(), Ok(route.clone()));
$update_add.cltv_expiry = 10; // causes outbound CLTV expiry to underflow
},
ForwardCheckFail::ForwardPayloadEncodedAsReceive => {
+ let recipient_onion_fields = RecipientOnionFields::spontaneous_empty();
let session_priv = SecretKey::from_slice(&[3; 32]).unwrap();
let onion_keys = onion_utils::construct_onion_keys(&Secp256k1::new(), &route.paths[0], &session_priv).unwrap();
let cur_height = nodes[0].best_block_info().1;
let (mut onion_payloads, ..) = onion_utils::build_onion_payloads(
- &route.paths[0], amt_msat, RecipientOnionFields::spontaneous_empty(), cur_height, &None).unwrap();
+ &route.paths[0], amt_msat, &recipient_onion_fields, cur_height, &None).unwrap();
// Remove the receive payload so the blinded forward payload is encoded as a final payload
// (i.e. next_hop_hmac == [0; 32])
onion_payloads.pop();
(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,
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 { .. } => {},
expect_pending_htlcs_forwardable!(nodes[2]);
expect_payment_claimable!(&nodes[2], payment_hash, payment_secret, amt_msat, None, nodes[2].node.get_our_node_id());
- do_claim_payment_along_route(&nodes[0], &vec!(&vec!(&nodes[1], &nodes[2])[..]), false, payment_preimage);
+ do_claim_payment_along_route(
+ ClaimAlongRouteArgs::new(&nodes[0], &[&[&nodes[1], &nodes[2]]], payment_preimage)
+ );
expect_payment_sent(&nodes[0], payment_preimage, Some(Some(1000)), true, true);
}
let session_priv = SecretKey::from_slice(&session_priv).unwrap();
let mut onion_keys = onion_utils::construct_onion_keys(&Secp256k1::new(), &route.paths[0], &session_priv).unwrap();
let cur_height = nodes[0].best_block_info().1;
+ let recipient_onion_fields = RecipientOnionFields::spontaneous_empty();
let (mut onion_payloads, ..) = onion_utils::build_onion_payloads(
- &route.paths[0], amt_msat, RecipientOnionFields::spontaneous_empty(), cur_height, &None).unwrap();
+ &route.paths[0], amt_msat, &recipient_onion_fields, cur_height, &None).unwrap();
let update_add = &mut payment_event_1_2.msgs[0];
onion_payloads.last_mut().map(|p| {
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]
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]
.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())
+ );
}