pub(super) struct SendAlongPathArgs<'a> {
pub path: &'a Path,
pub payment_hash: &'a PaymentHash,
- pub recipient_onion: RecipientOnionFields,
+ pub recipient_onion: &'a RecipientOnionFields,
pub total_value: u64,
pub cur_height: u32,
pub payment_id: PaymentId,
F: Fn(SendAlongPathArgs) -> Result<(), APIError>
{
let onion_session_privs = self.add_new_pending_payment(payment_hash, recipient_onion.clone(), payment_id, None, route, None, None, entropy_source, best_block_height)?;
- self.pay_route_internal(route, payment_hash, recipient_onion, None, payment_id, None,
+ self.pay_route_internal(route, payment_hash, &recipient_onion, None, payment_id, None,
onion_session_privs, node_signer, best_block_height, &send_payment_along_path)
.map_err(|e| { self.remove_outbound_if_all_failed(payment_id, &e); e })
}
let onion_session_privs = self.add_new_pending_payment(payment_hash, recipient_onion.clone(),
payment_id, Some(preimage), &route, None, None, entropy_source, best_block_height)?;
- match self.pay_route_internal(route, payment_hash, recipient_onion, Some(preimage),
+ match self.pay_route_internal(route, payment_hash, &recipient_onion, Some(preimage),
payment_id, None, onion_session_privs, node_signer, best_block_height, &send_payment_along_path
) {
Ok(()) => Ok(payment_hash),
RetryableSendFailure::DuplicatePayment
})?;
- let res = self.pay_route_internal(&route, payment_hash, recipient_onion, keysend_preimage, payment_id, None,
- onion_session_privs, node_signer, best_block_height, &send_payment_along_path);
+ let res = self.pay_route_internal(&route, payment_hash, &recipient_onion,
+ keysend_preimage, payment_id, None, onion_session_privs, node_signer,
+ best_block_height, &send_payment_along_path);
log_info!(logger, "Sending payment with id {} and hash {} returned {:?}",
payment_id, payment_hash, res);
if let Err(e) = res {
}
}
};
- let res = self.pay_route_internal(&route, payment_hash, recipient_onion, keysend_preimage,
+ let res = self.pay_route_internal(&route, payment_hash, &recipient_onion, keysend_preimage,
payment_id, Some(total_msat), onion_session_privs, node_signer, best_block_height,
&send_payment_along_path);
log_info!(logger, "Result retrying payment id {}: {:?}", &payment_id, res);
RecipientOnionFields::secret_only(payment_secret), payment_id, None, &route, None, None,
entropy_source, best_block_height)?;
- match self.pay_route_internal(&route, payment_hash, RecipientOnionFields::spontaneous_empty(),
+ let recipient_onion_fields = RecipientOnionFields::spontaneous_empty();
+ match self.pay_route_internal(&route, payment_hash, &recipient_onion_fields,
None, payment_id, None, onion_session_privs, node_signer, best_block_height, &send_payment_along_path
) {
Ok(()) => Ok((payment_hash, payment_id)),
}
fn pay_route_internal<NS: Deref, F>(
- &self, route: &Route, payment_hash: PaymentHash, recipient_onion: RecipientOnionFields,
+ &self, route: &Route, payment_hash: PaymentHash, recipient_onion: &RecipientOnionFields,
keysend_preimage: Option<PaymentPreimage>, payment_id: PaymentId, recv_value_msat: Option<u64>,
onion_session_privs: Vec<[u8; 32]>, node_signer: &NS, best_block_height: u32,
send_payment_along_path: &F
debug_assert_eq!(route.paths.len(), onion_session_privs.len());
for (path, session_priv_bytes) in route.paths.iter().zip(onion_session_privs.into_iter()) {
let mut path_res = send_payment_along_path(SendAlongPathArgs {
- path: &path, payment_hash: &payment_hash, recipient_onion: recipient_onion.clone(),
- total_value, cur_height, payment_id, keysend_preimage: &keysend_preimage, session_priv_bytes
+ path: &path, payment_hash: &payment_hash, recipient_onion, total_value,
+ cur_height, payment_id, keysend_preimage: &keysend_preimage,
+ session_priv_bytes
});
match path_res {
Ok(_) => {},
NS::Target: NodeSigner,
F: Fn(SendAlongPathArgs) -> Result<(), APIError>,
{
- self.pay_route_internal(route, payment_hash, recipient_onion, keysend_preimage, payment_id,
- recv_value_msat, onion_session_privs, node_signer, best_block_height,
- &send_payment_along_path)
+ self.pay_route_internal(route, payment_hash, &recipient_onion,
+ keysend_preimage, payment_id, recv_value_msat, onion_session_privs,
+ node_signer, best_block_height, &send_payment_along_path)
.map_err(|e| { self.remove_outbound_if_all_failed(payment_id, &e); e })
}