@@ -659,7 +659,7 @@ impl RecipientOnionFields {
659
659
pub ( super ) struct SendAlongPathArgs < ' a > {
660
660
pub path : & ' a Path ,
661
661
pub payment_hash : & ' a PaymentHash ,
662
- pub recipient_onion : RecipientOnionFields ,
662
+ pub recipient_onion : & ' a RecipientOnionFields ,
663
663
pub total_value : u64 ,
664
664
pub cur_height : u32 ,
665
665
pub payment_id : PaymentId ,
@@ -711,7 +711,7 @@ impl OutboundPayments {
711
711
F : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError >
712
712
{
713
713
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) ?;
714
- self . pay_route_internal ( route, payment_hash, recipient_onion, None , payment_id, None ,
714
+ self . pay_route_internal ( route, payment_hash, & recipient_onion, None , payment_id, None ,
715
715
onion_session_privs, node_signer, best_block_height, & send_payment_along_path)
716
716
. map_err ( |e| { self . remove_outbound_if_all_failed ( payment_id, & e) ; e } )
717
717
}
@@ -756,7 +756,7 @@ impl OutboundPayments {
756
756
let onion_session_privs = self . add_new_pending_payment ( payment_hash, recipient_onion. clone ( ) ,
757
757
payment_id, Some ( preimage) , & route, None , None , entropy_source, best_block_height) ?;
758
758
759
- match self . pay_route_internal ( route, payment_hash, recipient_onion, Some ( preimage) ,
759
+ match self . pay_route_internal ( route, payment_hash, & recipient_onion, Some ( preimage) ,
760
760
payment_id, None , onion_session_privs, node_signer, best_block_height, & send_payment_along_path
761
761
) {
762
762
Ok ( ( ) ) => Ok ( payment_hash) ,
@@ -932,8 +932,9 @@ impl OutboundPayments {
932
932
RetryableSendFailure :: DuplicatePayment
933
933
} ) ?;
934
934
935
- let res = self . pay_route_internal ( & route, payment_hash, recipient_onion, keysend_preimage, payment_id, None ,
936
- onion_session_privs, node_signer, best_block_height, & send_payment_along_path) ;
935
+ let res = self . pay_route_internal ( & route, payment_hash, & recipient_onion,
936
+ keysend_preimage, payment_id, None , onion_session_privs, node_signer,
937
+ best_block_height, & send_payment_along_path) ;
937
938
log_info ! ( logger, "Sending payment with id {} and hash {} returned {:?}" ,
938
939
payment_id, payment_hash, res) ;
939
940
if let Err ( e) = res {
@@ -1090,7 +1091,7 @@ impl OutboundPayments {
1090
1091
}
1091
1092
}
1092
1093
} ;
1093
- let res = self . pay_route_internal ( & route, payment_hash, recipient_onion, keysend_preimage,
1094
+ let res = self . pay_route_internal ( & route, payment_hash, & recipient_onion, keysend_preimage,
1094
1095
payment_id, Some ( total_msat) , onion_session_privs, node_signer, best_block_height,
1095
1096
& send_payment_along_path) ;
1096
1097
log_info ! ( logger, "Result retrying payment id {}: {:?}" , & payment_id, res) ;
@@ -1201,7 +1202,8 @@ impl OutboundPayments {
1201
1202
RecipientOnionFields :: secret_only ( payment_secret) , payment_id, None , & route, None , None ,
1202
1203
entropy_source, best_block_height) ?;
1203
1204
1204
- match self . pay_route_internal ( & route, payment_hash, RecipientOnionFields :: spontaneous_empty ( ) ,
1205
+ let recipient_onion_fields = RecipientOnionFields :: spontaneous_empty ( ) ;
1206
+ match self . pay_route_internal ( & route, payment_hash, & recipient_onion_fields,
1205
1207
None , payment_id, None , onion_session_privs, node_signer, best_block_height, & send_payment_along_path
1206
1208
) {
1207
1209
Ok ( ( ) ) => Ok ( ( payment_hash, payment_id) ) ,
@@ -1309,7 +1311,7 @@ impl OutboundPayments {
1309
1311
}
1310
1312
1311
1313
fn pay_route_internal < NS : Deref , F > (
1312
- & self , route : & Route , payment_hash : PaymentHash , recipient_onion : RecipientOnionFields ,
1314
+ & self , route : & Route , payment_hash : PaymentHash , recipient_onion : & RecipientOnionFields ,
1313
1315
keysend_preimage : Option < PaymentPreimage > , payment_id : PaymentId , recv_value_msat : Option < u64 > ,
1314
1316
onion_session_privs : Vec < [ u8 ; 32 ] > , node_signer : & NS , best_block_height : u32 ,
1315
1317
send_payment_along_path : & F
@@ -1364,8 +1366,9 @@ impl OutboundPayments {
1364
1366
debug_assert_eq ! ( route. paths. len( ) , onion_session_privs. len( ) ) ;
1365
1367
for ( path, session_priv_bytes) in route. paths . iter ( ) . zip ( onion_session_privs. into_iter ( ) ) {
1366
1368
let mut path_res = send_payment_along_path ( SendAlongPathArgs {
1367
- path : & path, payment_hash : & payment_hash, recipient_onion : recipient_onion. clone ( ) ,
1368
- total_value, cur_height, payment_id, keysend_preimage : & keysend_preimage, session_priv_bytes
1369
+ path : & path, payment_hash : & payment_hash, recipient_onion, total_value,
1370
+ cur_height, payment_id, keysend_preimage : & keysend_preimage,
1371
+ session_priv_bytes
1369
1372
} ) ;
1370
1373
match path_res {
1371
1374
Ok ( _) => { } ,
@@ -1448,9 +1451,9 @@ impl OutboundPayments {
1448
1451
NS :: Target : NodeSigner ,
1449
1452
F : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
1450
1453
{
1451
- self . pay_route_internal ( route, payment_hash, recipient_onion, keysend_preimage , payment_id ,
1452
- recv_value_msat , onion_session_privs , node_signer , best_block_height ,
1453
- & send_payment_along_path)
1454
+ self . pay_route_internal ( route, payment_hash, & recipient_onion,
1455
+ keysend_preimage , payment_id , recv_value_msat , onion_session_privs ,
1456
+ node_signer , best_block_height , & send_payment_along_path)
1454
1457
. map_err ( |e| { self . remove_outbound_if_all_failed ( payment_id, & e) ; e } )
1455
1458
}
1456
1459
0 commit comments