Skip to content

Commit c6f2768

Browse files
Outbound payments: pass session privs by reference
We need to stop passing this Vec by value for the next commit so we can pass it to a different method.
1 parent c835e80 commit c6f2768

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lightning/src/ln/outbound_payment.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ impl OutboundPayments {
803803
{
804804
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)?;
805805
self.pay_route_internal(route, payment_hash, &recipient_onion, None, None, payment_id, None,
806-
onion_session_privs, node_signer, best_block_height, &send_payment_along_path)
806+
&onion_session_privs, node_signer, best_block_height, &send_payment_along_path)
807807
.map_err(|e| { self.remove_outbound_if_all_failed(payment_id, &e); e })
808808
}
809809

@@ -983,7 +983,7 @@ impl OutboundPayments {
983983

984984
let result = self.pay_route_internal(
985985
&route, payment_hash, &recipient_onion, keysend_preimage, invoice_request, payment_id,
986-
Some(route_params.final_value_msat), onion_session_privs, node_signer, best_block_height,
986+
Some(route_params.final_value_msat), &onion_session_privs, node_signer, best_block_height,
987987
&send_payment_along_path
988988
);
989989
log_info!(
@@ -1269,7 +1269,7 @@ impl OutboundPayments {
12691269
})?;
12701270

12711271
let res = self.pay_route_internal(&route, payment_hash, &recipient_onion,
1272-
keysend_preimage, None, payment_id, None, onion_session_privs, node_signer,
1272+
keysend_preimage, None, payment_id, None, &onion_session_privs, node_signer,
12731273
best_block_height, &send_payment_along_path);
12741274
log_info!(logger, "Sending payment with id {} and hash {} returned {:?}",
12751275
payment_id, payment_hash, res);
@@ -1426,7 +1426,7 @@ impl OutboundPayments {
14261426
}
14271427
};
14281428
let res = self.pay_route_internal(&route, payment_hash, &recipient_onion, keysend_preimage,
1429-
invoice_request.as_ref(), payment_id, Some(total_msat), onion_session_privs, node_signer,
1429+
invoice_request.as_ref(), payment_id, Some(total_msat), &onion_session_privs, node_signer,
14301430
best_block_height, &send_payment_along_path);
14311431
log_info!(logger, "Result retrying payment id {}: {:?}", &payment_id, res);
14321432
if let Err(e) = res {
@@ -1542,7 +1542,7 @@ impl OutboundPayments {
15421542

15431543
let recipient_onion_fields = RecipientOnionFields::spontaneous_empty();
15441544
match self.pay_route_internal(&route, payment_hash, &recipient_onion_fields,
1545-
None, None, payment_id, None, onion_session_privs, node_signer, best_block_height,
1545+
None, None, payment_id, None, &onion_session_privs, node_signer, best_block_height,
15461546
&send_payment_along_path
15471547
) {
15481548
Ok(()) => Ok((payment_hash, payment_id)),
@@ -1733,7 +1733,7 @@ impl OutboundPayments {
17331733
fn pay_route_internal<NS: Deref, F>(
17341734
&self, route: &Route, payment_hash: PaymentHash, recipient_onion: &RecipientOnionFields,
17351735
keysend_preimage: Option<PaymentPreimage>, invoice_request: Option<&InvoiceRequest>,
1736-
payment_id: PaymentId, recv_value_msat: Option<u64>, onion_session_privs: Vec<[u8; 32]>,
1736+
payment_id: PaymentId, recv_value_msat: Option<u64>, onion_session_privs: &Vec<[u8; 32]>,
17371737
node_signer: &NS, best_block_height: u32, send_payment_along_path: &F
17381738
) -> Result<(), PaymentSendFailure>
17391739
where
@@ -1788,7 +1788,7 @@ impl OutboundPayments {
17881788
let mut path_res = send_payment_along_path(SendAlongPathArgs {
17891789
path: &path, payment_hash: &payment_hash, recipient_onion, total_value,
17901790
cur_height, payment_id, keysend_preimage: &keysend_preimage, invoice_request,
1791-
session_priv_bytes
1791+
session_priv_bytes: *session_priv_bytes
17921792
});
17931793
match path_res {
17941794
Ok(_) => {},
@@ -1872,7 +1872,7 @@ impl OutboundPayments {
18721872
F: Fn(SendAlongPathArgs) -> Result<(), APIError>,
18731873
{
18741874
self.pay_route_internal(route, payment_hash, &recipient_onion,
1875-
keysend_preimage, None, payment_id, recv_value_msat, onion_session_privs,
1875+
keysend_preimage, None, payment_id, recv_value_msat, &onion_session_privs,
18761876
node_signer, best_block_height, &send_payment_along_path)
18771877
.map_err(|e| { self.remove_outbound_if_all_failed(payment_id, &e); e })
18781878
}

0 commit comments

Comments
 (0)