@@ -780,7 +780,7 @@ impl OutboundPayments {
780
780
781
781
pub ( super ) fn send_payment < R : Deref , ES : Deref , NS : Deref , IH , SP , L : Deref > (
782
782
& self , payment_hash : PaymentHash , recipient_onion : RecipientOnionFields , payment_id : PaymentId ,
783
- retry_strategy : Retry , route_params : RouteParameters , router : & R ,
783
+ retry_strategy : Retry , route_params : RouteParameters , router : R ,
784
784
first_hops : Vec < ChannelDetails > , compute_inflight_htlcs : IH , entropy_source : & ES ,
785
785
node_signer : & NS , best_block_height : u32 , logger : & L ,
786
786
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > , send_payment_along_path : SP ,
@@ -817,7 +817,7 @@ impl OutboundPayments {
817
817
818
818
pub ( super ) fn send_spontaneous_payment < R : Deref , ES : Deref , NS : Deref , IH , SP , L : Deref > (
819
819
& self , payment_preimage : Option < PaymentPreimage > , recipient_onion : RecipientOnionFields ,
820
- payment_id : PaymentId , retry_strategy : Retry , route_params : RouteParameters , router : & R ,
820
+ payment_id : PaymentId , retry_strategy : Retry , route_params : RouteParameters , router : R ,
821
821
first_hops : Vec < ChannelDetails > , inflight_htlcs : IH , entropy_source : & ES ,
822
822
node_signer : & NS , best_block_height : u32 , logger : & L ,
823
823
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > , send_payment_along_path : SP
@@ -842,7 +842,7 @@ impl OutboundPayments {
842
842
pub ( super ) fn send_payment_for_bolt12_invoice <
843
843
R : Deref , ES : Deref , NS : Deref , NL : Deref , IH , SP , L : Deref
844
844
> (
845
- & self , invoice : & Bolt12Invoice , payment_id : PaymentId , router : & R ,
845
+ & self , invoice : & Bolt12Invoice , payment_id : PaymentId , router : R ,
846
846
first_hops : Vec < ChannelDetails > , features : Bolt12InvoiceFeatures , inflight_htlcs : IH ,
847
847
entropy_source : & ES , node_signer : & NS , node_id_lookup : & NL ,
848
848
secp_ctx : & Secp256k1 < secp256k1:: All > , best_block_height : u32 , logger : & L ,
@@ -904,7 +904,7 @@ impl OutboundPayments {
904
904
> (
905
905
& self , payment_id : PaymentId , payment_hash : PaymentHash ,
906
906
keysend_preimage : Option < PaymentPreimage > , invoice_request : Option < & InvoiceRequest > ,
907
- mut route_params : RouteParameters , retry_strategy : Retry , router : & R ,
907
+ mut route_params : RouteParameters , retry_strategy : Retry , router : R ,
908
908
first_hops : Vec < ChannelDetails > , inflight_htlcs : IH , entropy_source : & ES , node_signer : & NS ,
909
909
node_id_lookup : & NL , secp_ctx : & Secp256k1 < secp256k1:: All > , best_block_height : u32 , logger : & L ,
910
910
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > ,
@@ -944,8 +944,8 @@ impl OutboundPayments {
944
944
} ;
945
945
let route = match self . find_initial_route (
946
946
payment_id, payment_hash, & recipient_onion, keysend_preimage, invoice_request,
947
- & mut route_params, router, & first_hops, & inflight_htlcs, node_signer, best_block_height ,
948
- logger,
947
+ & mut route_params, router. deref ( ) , & first_hops, & inflight_htlcs, node_signer,
948
+ best_block_height , logger,
949
949
) {
950
950
Ok ( route) => route,
951
951
Err ( e) => {
@@ -1092,7 +1092,7 @@ impl OutboundPayments {
1092
1092
pub ( super ) fn send_payment_for_static_invoice <
1093
1093
R : Deref , ES : Deref , NS : Deref , NL : Deref , IH , SP , L : Deref
1094
1094
> (
1095
- & self , payment_id : PaymentId , router : & R , first_hops : Vec < ChannelDetails > , inflight_htlcs : IH ,
1095
+ & self , payment_id : PaymentId , router : R , first_hops : Vec < ChannelDetails > , inflight_htlcs : IH ,
1096
1096
entropy_source : & ES , node_signer : & NS , node_id_lookup : & NL ,
1097
1097
secp_ctx : & Secp256k1 < secp256k1:: All > , best_block_height : u32 , logger : & L ,
1098
1098
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > ,
@@ -1129,7 +1129,7 @@ impl OutboundPayments {
1129
1129
}
1130
1130
1131
1131
pub ( super ) fn check_retry_payments < R : Deref , ES : Deref , NS : Deref , SP , IH , FH , L : Deref > (
1132
- & self , router : & R , first_hops : FH , inflight_htlcs : IH , entropy_source : & ES , node_signer : & NS ,
1132
+ & self , router : R , first_hops : FH , inflight_htlcs : IH , entropy_source : & ES , node_signer : & NS ,
1133
1133
best_block_height : u32 ,
1134
1134
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > , logger : & L ,
1135
1135
send_payment_along_path : SP ,
@@ -1163,7 +1163,7 @@ impl OutboundPayments {
1163
1163
}
1164
1164
core:: mem:: drop ( outbounds) ;
1165
1165
if let Some ( ( payment_hash, payment_id, route_params) ) = retry_id_route_params {
1166
- self . find_route_and_send_payment ( payment_hash, payment_id, route_params, router, first_hops ( ) , & inflight_htlcs, entropy_source, node_signer, best_block_height, logger, pending_events, & send_payment_along_path)
1166
+ self . find_route_and_send_payment ( payment_hash, payment_id, route_params, router. deref ( ) , first_hops ( ) , & inflight_htlcs, entropy_source, node_signer, best_block_height, logger, pending_events, & send_payment_along_path)
1167
1167
} else { break }
1168
1168
}
1169
1169
@@ -1195,7 +1195,7 @@ impl OutboundPayments {
1195
1195
fn find_initial_route < R : Deref , NS : Deref , IH , L : Deref > (
1196
1196
& self , payment_id : PaymentId , payment_hash : PaymentHash , recipient_onion : & RecipientOnionFields ,
1197
1197
keysend_preimage : Option < PaymentPreimage > , invoice_request : Option < & InvoiceRequest > ,
1198
- route_params : & mut RouteParameters , router : & R , first_hops : & Vec < ChannelDetails > ,
1198
+ route_params : & mut RouteParameters , router : R , first_hops : & Vec < ChannelDetails > ,
1199
1199
inflight_htlcs : & IH , node_signer : & NS , best_block_height : u32 , logger : & L ,
1200
1200
) -> Result < Route , RetryableSendFailure >
1201
1201
where
@@ -1249,7 +1249,7 @@ impl OutboundPayments {
1249
1249
fn send_payment_internal < R : Deref , NS : Deref , ES : Deref , IH , SP , L : Deref > (
1250
1250
& self , payment_id : PaymentId , payment_hash : PaymentHash , recipient_onion : RecipientOnionFields ,
1251
1251
keysend_preimage : Option < PaymentPreimage > , retry_strategy : Retry , mut route_params : RouteParameters ,
1252
- router : & R , first_hops : Vec < ChannelDetails > , inflight_htlcs : IH , entropy_source : & ES ,
1252
+ router : R , first_hops : Vec < ChannelDetails > , inflight_htlcs : IH , entropy_source : & ES ,
1253
1253
node_signer : & NS , best_block_height : u32 , logger : & L ,
1254
1254
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > , send_payment_along_path : SP ,
1255
1255
) -> Result < ( ) , RetryableSendFailure >
@@ -1262,8 +1262,8 @@ impl OutboundPayments {
1262
1262
SP : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
1263
1263
{
1264
1264
let route = self . find_initial_route (
1265
- payment_id, payment_hash, & recipient_onion, keysend_preimage, None , & mut route_params, router ,
1266
- & first_hops, & inflight_htlcs, node_signer, best_block_height, logger,
1265
+ payment_id, payment_hash, & recipient_onion, keysend_preimage, None , & mut route_params,
1266
+ router . deref ( ) , & first_hops, & inflight_htlcs, node_signer, best_block_height, logger,
1267
1267
) ?;
1268
1268
1269
1269
let onion_session_privs = self . add_new_pending_payment ( payment_hash,
@@ -1292,7 +1292,7 @@ impl OutboundPayments {
1292
1292
1293
1293
fn find_route_and_send_payment < R : Deref , NS : Deref , ES : Deref , IH , SP , L : Deref > (
1294
1294
& self , payment_hash : PaymentHash , payment_id : PaymentId , route_params : RouteParameters ,
1295
- router : & R , first_hops : Vec < ChannelDetails > , inflight_htlcs : & IH , entropy_source : & ES ,
1295
+ router : R , first_hops : Vec < ChannelDetails > , inflight_htlcs : & IH , entropy_source : & ES ,
1296
1296
node_signer : & NS , best_block_height : u32 , logger : & L ,
1297
1297
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > , send_payment_along_path : & SP ,
1298
1298
)
@@ -1451,7 +1451,7 @@ impl OutboundPayments {
1451
1451
1452
1452
fn handle_pay_route_err < R : Deref , NS : Deref , ES : Deref , IH , SP , L : Deref > (
1453
1453
& self , err : PaymentSendFailure , payment_id : PaymentId , payment_hash : PaymentHash , route : Route ,
1454
- mut route_params : RouteParameters , onion_session_privs : Vec < [ u8 ; 32 ] > , router : & R ,
1454
+ mut route_params : RouteParameters , onion_session_privs : Vec < [ u8 ; 32 ] > , router : R ,
1455
1455
first_hops : Vec < ChannelDetails > , inflight_htlcs : & IH , entropy_source : & ES , node_signer : & NS ,
1456
1456
best_block_height : u32 , logger : & L ,
1457
1457
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > ,
@@ -2505,7 +2505,7 @@ mod tests {
2505
2505
Some ( Retry :: Attempts ( 1 ) ) , Some ( expired_route_params. payment_params . clone ( ) ) ,
2506
2506
& & keys_manager, 0 ) . unwrap ( ) ;
2507
2507
outbound_payments. find_route_and_send_payment (
2508
- PaymentHash ( [ 0 ; 32 ] ) , PaymentId ( [ 0 ; 32 ] ) , expired_route_params, & & router, vec ! [ ] ,
2508
+ PaymentHash ( [ 0 ; 32 ] ) , PaymentId ( [ 0 ; 32 ] ) , expired_route_params, & router, vec ! [ ] ,
2509
2509
& || InFlightHtlcs :: new ( ) , & & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2510
2510
& |_| Ok ( ( ) ) ) ;
2511
2511
let events = pending_events. lock ( ) . unwrap ( ) ;
@@ -2516,7 +2516,7 @@ mod tests {
2516
2516
} else {
2517
2517
let err = outbound_payments. send_payment (
2518
2518
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 0 ; 32 ] ) ,
2519
- Retry :: Attempts ( 0 ) , expired_route_params, & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2519
+ Retry :: Attempts ( 0 ) , expired_route_params, & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2520
2520
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events, |_| Ok ( ( ) ) ) . unwrap_err ( ) ;
2521
2521
if let RetryableSendFailure :: PaymentExpired = err { } else { panic ! ( "Unexpected error" ) ; }
2522
2522
}
@@ -2549,7 +2549,7 @@ mod tests {
2549
2549
Some ( Retry :: Attempts ( 1 ) ) , Some ( route_params. payment_params . clone ( ) ) ,
2550
2550
& & keys_manager, 0 ) . unwrap ( ) ;
2551
2551
outbound_payments. find_route_and_send_payment (
2552
- PaymentHash ( [ 0 ; 32 ] ) , PaymentId ( [ 0 ; 32 ] ) , route_params, & & router, vec ! [ ] ,
2552
+ PaymentHash ( [ 0 ; 32 ] ) , PaymentId ( [ 0 ; 32 ] ) , route_params, & router, vec ! [ ] ,
2553
2553
& || InFlightHtlcs :: new ( ) , & & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2554
2554
& |_| Ok ( ( ) ) ) ;
2555
2555
let events = pending_events. lock ( ) . unwrap ( ) ;
@@ -2558,7 +2558,7 @@ mod tests {
2558
2558
} else {
2559
2559
let err = outbound_payments. send_payment (
2560
2560
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 0 ; 32 ] ) ,
2561
- Retry :: Attempts ( 0 ) , route_params, & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2561
+ Retry :: Attempts ( 0 ) , route_params, & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2562
2562
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events, |_| Ok ( ( ) ) ) . unwrap_err ( ) ;
2563
2563
if let RetryableSendFailure :: RouteNotFound = err {
2564
2564
} else { panic ! ( "Unexpected error" ) ; }
@@ -2606,7 +2606,7 @@ mod tests {
2606
2606
let pending_events = Mutex :: new ( VecDeque :: new ( ) ) ;
2607
2607
outbound_payments. send_payment (
2608
2608
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 0 ; 32 ] ) ,
2609
- Retry :: Attempts ( 0 ) , route_params. clone ( ) , & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2609
+ Retry :: Attempts ( 0 ) , route_params. clone ( ) , & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2610
2610
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2611
2611
|_| Err ( APIError :: ChannelUnavailable { err : "test" . to_owned ( ) } ) ) . unwrap ( ) ;
2612
2612
let mut events = pending_events. lock ( ) . unwrap ( ) ;
@@ -2624,15 +2624,15 @@ mod tests {
2624
2624
// Ensure that a MonitorUpdateInProgress "error" will not result in a PaymentPathFailed event.
2625
2625
outbound_payments. send_payment (
2626
2626
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 0 ; 32 ] ) ,
2627
- Retry :: Attempts ( 0 ) , route_params. clone ( ) , & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2627
+ Retry :: Attempts ( 0 ) , route_params. clone ( ) , & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2628
2628
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2629
2629
|_| Err ( APIError :: MonitorUpdateInProgress ) ) . unwrap ( ) ;
2630
2630
assert_eq ! ( pending_events. lock( ) . unwrap( ) . len( ) , 0 ) ;
2631
2631
2632
2632
// Ensure that any other error will result in a PaymentPathFailed event but no blamed scid.
2633
2633
outbound_payments. send_payment (
2634
2634
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 1 ; 32 ] ) ,
2635
- Retry :: Attempts ( 0 ) , route_params. clone ( ) , & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2635
+ Retry :: Attempts ( 0 ) , route_params. clone ( ) , & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2636
2636
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2637
2637
|_| Err ( APIError :: APIMisuseError { err : "test" . to_owned ( ) } ) ) . unwrap ( ) ;
2638
2638
let events = pending_events. lock ( ) . unwrap ( ) ;
@@ -2818,7 +2818,7 @@ mod tests {
2818
2818
2819
2819
assert_eq ! (
2820
2820
outbound_payments. send_payment_for_bolt12_invoice(
2821
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2821
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2822
2822
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2823
2823
& secp_ctx, 0 , &&logger, & pending_events, |_| panic!( )
2824
2824
) ,
@@ -2880,7 +2880,7 @@ mod tests {
2880
2880
2881
2881
assert_eq ! (
2882
2882
outbound_payments. send_payment_for_bolt12_invoice(
2883
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2883
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2884
2884
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2885
2885
& secp_ctx, 0 , &&logger, & pending_events, |_| panic!( )
2886
2886
) ,
@@ -2955,7 +2955,7 @@ mod tests {
2955
2955
assert ! ( !outbound_payments. has_pending_payments( ) ) ;
2956
2956
assert_eq ! (
2957
2957
outbound_payments. send_payment_for_bolt12_invoice(
2958
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2958
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2959
2959
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2960
2960
& secp_ctx, 0 , &&logger, & pending_events, |_| panic!( )
2961
2961
) ,
@@ -2973,7 +2973,7 @@ mod tests {
2973
2973
2974
2974
assert_eq ! (
2975
2975
outbound_payments. send_payment_for_bolt12_invoice(
2976
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2976
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2977
2977
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2978
2978
& secp_ctx, 0 , &&logger, & pending_events, |_| Ok ( ( ) )
2979
2979
) ,
@@ -2984,7 +2984,7 @@ mod tests {
2984
2984
2985
2985
assert_eq ! (
2986
2986
outbound_payments. send_payment_for_bolt12_invoice(
2987
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2987
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2988
2988
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2989
2989
& secp_ctx, 0 , &&logger, & pending_events, |_| panic!( )
2990
2990
) ,
0 commit comments