@@ -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 > ) > > ,
@@ -2507,7 +2507,7 @@ mod tests {
2507
2507
Some ( Retry :: Attempts ( 1 ) ) , Some ( expired_route_params. payment_params . clone ( ) ) ,
2508
2508
& & keys_manager, 0 ) . unwrap ( ) ;
2509
2509
outbound_payments. find_route_and_send_payment (
2510
- PaymentHash ( [ 0 ; 32 ] ) , PaymentId ( [ 0 ; 32 ] ) , expired_route_params, & & router, vec ! [ ] ,
2510
+ PaymentHash ( [ 0 ; 32 ] ) , PaymentId ( [ 0 ; 32 ] ) , expired_route_params, & router, vec ! [ ] ,
2511
2511
& || InFlightHtlcs :: new ( ) , & & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2512
2512
& |_| Ok ( ( ) ) ) ;
2513
2513
let events = pending_events. lock ( ) . unwrap ( ) ;
@@ -2518,7 +2518,7 @@ mod tests {
2518
2518
} else {
2519
2519
let err = outbound_payments. send_payment (
2520
2520
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 0 ; 32 ] ) ,
2521
- Retry :: Attempts ( 0 ) , expired_route_params, & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2521
+ Retry :: Attempts ( 0 ) , expired_route_params, & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2522
2522
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events, |_| Ok ( ( ) ) ) . unwrap_err ( ) ;
2523
2523
if let RetryableSendFailure :: PaymentExpired = err { } else { panic ! ( "Unexpected error" ) ; }
2524
2524
}
@@ -2551,7 +2551,7 @@ mod tests {
2551
2551
Some ( Retry :: Attempts ( 1 ) ) , Some ( route_params. payment_params . clone ( ) ) ,
2552
2552
& & keys_manager, 0 ) . unwrap ( ) ;
2553
2553
outbound_payments. find_route_and_send_payment (
2554
- PaymentHash ( [ 0 ; 32 ] ) , PaymentId ( [ 0 ; 32 ] ) , route_params, & & router, vec ! [ ] ,
2554
+ PaymentHash ( [ 0 ; 32 ] ) , PaymentId ( [ 0 ; 32 ] ) , route_params, & router, vec ! [ ] ,
2555
2555
& || InFlightHtlcs :: new ( ) , & & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2556
2556
& |_| Ok ( ( ) ) ) ;
2557
2557
let events = pending_events. lock ( ) . unwrap ( ) ;
@@ -2560,7 +2560,7 @@ mod tests {
2560
2560
} else {
2561
2561
let err = outbound_payments. send_payment (
2562
2562
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 0 ; 32 ] ) ,
2563
- Retry :: Attempts ( 0 ) , route_params, & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2563
+ Retry :: Attempts ( 0 ) , route_params, & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2564
2564
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events, |_| Ok ( ( ) ) ) . unwrap_err ( ) ;
2565
2565
if let RetryableSendFailure :: RouteNotFound = err {
2566
2566
} else { panic ! ( "Unexpected error" ) ; }
@@ -2608,7 +2608,7 @@ mod tests {
2608
2608
let pending_events = Mutex :: new ( VecDeque :: new ( ) ) ;
2609
2609
outbound_payments. send_payment (
2610
2610
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 0 ; 32 ] ) ,
2611
- Retry :: Attempts ( 0 ) , route_params. clone ( ) , & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2611
+ Retry :: Attempts ( 0 ) , route_params. clone ( ) , & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2612
2612
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2613
2613
|_| Err ( APIError :: ChannelUnavailable { err : "test" . to_owned ( ) } ) ) . unwrap ( ) ;
2614
2614
let mut events = pending_events. lock ( ) . unwrap ( ) ;
@@ -2626,15 +2626,15 @@ mod tests {
2626
2626
// Ensure that a MonitorUpdateInProgress "error" will not result in a PaymentPathFailed event.
2627
2627
outbound_payments. send_payment (
2628
2628
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 0 ; 32 ] ) ,
2629
- Retry :: Attempts ( 0 ) , route_params. clone ( ) , & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2629
+ Retry :: Attempts ( 0 ) , route_params. clone ( ) , & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2630
2630
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2631
2631
|_| Err ( APIError :: MonitorUpdateInProgress ) ) . unwrap ( ) ;
2632
2632
assert_eq ! ( pending_events. lock( ) . unwrap( ) . len( ) , 0 ) ;
2633
2633
2634
2634
// Ensure that any other error will result in a PaymentPathFailed event but no blamed scid.
2635
2635
outbound_payments. send_payment (
2636
2636
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 1 ; 32 ] ) ,
2637
- Retry :: Attempts ( 0 ) , route_params. clone ( ) , & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2637
+ Retry :: Attempts ( 0 ) , route_params. clone ( ) , & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2638
2638
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2639
2639
|_| Err ( APIError :: APIMisuseError { err : "test" . to_owned ( ) } ) ) . unwrap ( ) ;
2640
2640
let events = pending_events. lock ( ) . unwrap ( ) ;
@@ -2820,7 +2820,7 @@ mod tests {
2820
2820
2821
2821
assert_eq ! (
2822
2822
outbound_payments. send_payment_for_bolt12_invoice(
2823
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2823
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2824
2824
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2825
2825
& secp_ctx, 0 , &&logger, & pending_events, |_| panic!( )
2826
2826
) ,
@@ -2882,7 +2882,7 @@ mod tests {
2882
2882
2883
2883
assert_eq ! (
2884
2884
outbound_payments. send_payment_for_bolt12_invoice(
2885
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2885
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2886
2886
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2887
2887
& secp_ctx, 0 , &&logger, & pending_events, |_| panic!( )
2888
2888
) ,
@@ -2957,7 +2957,7 @@ mod tests {
2957
2957
assert ! ( !outbound_payments. has_pending_payments( ) ) ;
2958
2958
assert_eq ! (
2959
2959
outbound_payments. send_payment_for_bolt12_invoice(
2960
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2960
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2961
2961
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2962
2962
& secp_ctx, 0 , &&logger, & pending_events, |_| panic!( )
2963
2963
) ,
@@ -2975,7 +2975,7 @@ mod tests {
2975
2975
2976
2976
assert_eq ! (
2977
2977
outbound_payments. send_payment_for_bolt12_invoice(
2978
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2978
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2979
2979
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2980
2980
& secp_ctx, 0 , &&logger, & pending_events, |_| Ok ( ( ) )
2981
2981
) ,
@@ -2986,7 +2986,7 @@ mod tests {
2986
2986
2987
2987
assert_eq ! (
2988
2988
outbound_payments. send_payment_for_bolt12_invoice(
2989
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2989
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2990
2990
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2991
2991
& secp_ctx, 0 , &&logger, & pending_events, |_| panic!( )
2992
2992
) ,
0 commit comments