Skip to content

Commit 490777c

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 aa2c6fe commit 490777c

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
@@ -811,7 +811,7 @@ impl OutboundPayments {
811811
{
812812
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)?;
813813
self.pay_route_internal(route, payment_hash, &recipient_onion, None, None, payment_id, None,
814-
onion_session_privs, node_signer, best_block_height, &send_payment_along_path)
814+
&onion_session_privs, node_signer, best_block_height, &send_payment_along_path)
815815
.map_err(|e| { self.remove_outbound_if_all_failed(payment_id, &e); e })
816816
}
817817

@@ -991,7 +991,7 @@ impl OutboundPayments {
991991

992992
let result = self.pay_route_internal(
993993
&route, payment_hash, &recipient_onion, keysend_preimage, invoice_request, payment_id,
994-
Some(route_params.final_value_msat), onion_session_privs, node_signer, best_block_height,
994+
Some(route_params.final_value_msat), &onion_session_privs, node_signer, best_block_height,
995995
&send_payment_along_path
996996
);
997997
log_info!(
@@ -1276,7 +1276,7 @@ impl OutboundPayments {
12761276
})?;
12771277

12781278
let res = self.pay_route_internal(&route, payment_hash, &recipient_onion,
1279-
keysend_preimage, None, payment_id, None, onion_session_privs, node_signer,
1279+
keysend_preimage, None, payment_id, None, &onion_session_privs, node_signer,
12801280
best_block_height, &send_payment_along_path);
12811281
log_info!(logger, "Sending payment with id {} and hash {} returned {:?}",
12821282
payment_id, payment_hash, res);
@@ -1433,7 +1433,7 @@ impl OutboundPayments {
14331433
}
14341434
};
14351435
let res = self.pay_route_internal(&route, payment_hash, &recipient_onion, keysend_preimage,
1436-
invoice_request.as_ref(), payment_id, Some(total_msat), onion_session_privs, node_signer,
1436+
invoice_request.as_ref(), payment_id, Some(total_msat), &onion_session_privs, node_signer,
14371437
best_block_height, &send_payment_along_path);
14381438
log_info!(logger, "Result retrying payment id {}: {:?}", &payment_id, res);
14391439
if let Err(e) = res {
@@ -1549,7 +1549,7 @@ impl OutboundPayments {
15491549

15501550
let recipient_onion_fields = RecipientOnionFields::spontaneous_empty();
15511551
match self.pay_route_internal(&route, payment_hash, &recipient_onion_fields,
1552-
None, None, payment_id, None, onion_session_privs, node_signer, best_block_height,
1552+
None, None, payment_id, None, &onion_session_privs, node_signer, best_block_height,
15531553
&send_payment_along_path
15541554
) {
15551555
Ok(()) => Ok((payment_hash, payment_id)),
@@ -1740,7 +1740,7 @@ impl OutboundPayments {
17401740
fn pay_route_internal<NS: Deref, F>(
17411741
&self, route: &Route, payment_hash: PaymentHash, recipient_onion: &RecipientOnionFields,
17421742
keysend_preimage: Option<PaymentPreimage>, invoice_request: Option<&InvoiceRequest>,
1743-
payment_id: PaymentId, recv_value_msat: Option<u64>, onion_session_privs: Vec<[u8; 32]>,
1743+
payment_id: PaymentId, recv_value_msat: Option<u64>, onion_session_privs: &Vec<[u8; 32]>,
17441744
node_signer: &NS, best_block_height: u32, send_payment_along_path: &F
17451745
) -> Result<(), PaymentSendFailure>
17461746
where
@@ -1795,7 +1795,7 @@ impl OutboundPayments {
17951795
let mut path_res = send_payment_along_path(SendAlongPathArgs {
17961796
path: &path, payment_hash: &payment_hash, recipient_onion, total_value,
17971797
cur_height, payment_id, keysend_preimage: &keysend_preimage, invoice_request,
1798-
session_priv_bytes
1798+
session_priv_bytes: *session_priv_bytes
17991799
});
18001800
match path_res {
18011801
Ok(_) => {},
@@ -1879,7 +1879,7 @@ impl OutboundPayments {
18791879
F: Fn(SendAlongPathArgs) -> Result<(), APIError>,
18801880
{
18811881
self.pay_route_internal(route, payment_hash, &recipient_onion,
1882-
keysend_preimage, None, payment_id, recv_value_msat, onion_session_privs,
1882+
keysend_preimage, None, payment_id, recv_value_msat, &onion_session_privs,
18831883
node_signer, best_block_height, &send_payment_along_path)
18841884
.map_err(|e| { self.remove_outbound_if_all_failed(payment_id, &e); e })
18851885
}

0 commit comments

Comments
 (0)