@@ -772,7 +772,7 @@ impl OutboundPayments {
772
772
773
773
pub ( super ) fn send_payment < R : Deref , ES : Deref , NS : Deref , IH , SP , L : Deref > (
774
774
& self , payment_hash : PaymentHash , recipient_onion : RecipientOnionFields , payment_id : PaymentId ,
775
- retry_strategy : Retry , route_params : RouteParameters , router : & R ,
775
+ retry_strategy : Retry , route_params : RouteParameters , router : R ,
776
776
first_hops : Vec < ChannelDetails > , compute_inflight_htlcs : IH , entropy_source : & ES ,
777
777
node_signer : & NS , best_block_height : u32 , logger : & L ,
778
778
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > , send_payment_along_path : SP ,
@@ -809,7 +809,7 @@ impl OutboundPayments {
809
809
810
810
pub ( super ) fn send_spontaneous_payment < R : Deref , ES : Deref , NS : Deref , IH , SP , L : Deref > (
811
811
& self , payment_preimage : Option < PaymentPreimage > , recipient_onion : RecipientOnionFields ,
812
- payment_id : PaymentId , retry_strategy : Retry , route_params : RouteParameters , router : & R ,
812
+ payment_id : PaymentId , retry_strategy : Retry , route_params : RouteParameters , router : R ,
813
813
first_hops : Vec < ChannelDetails > , inflight_htlcs : IH , entropy_source : & ES ,
814
814
node_signer : & NS , best_block_height : u32 , logger : & L ,
815
815
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > , send_payment_along_path : SP
@@ -834,7 +834,7 @@ impl OutboundPayments {
834
834
pub ( super ) fn send_payment_for_bolt12_invoice <
835
835
R : Deref , ES : Deref , NS : Deref , NL : Deref , IH , SP , L : Deref
836
836
> (
837
- & self , invoice : & Bolt12Invoice , payment_id : PaymentId , router : & R ,
837
+ & self , invoice : & Bolt12Invoice , payment_id : PaymentId , router : R ,
838
838
first_hops : Vec < ChannelDetails > , features : Bolt12InvoiceFeatures , inflight_htlcs : IH ,
839
839
entropy_source : & ES , node_signer : & NS , node_id_lookup : & NL ,
840
840
secp_ctx : & Secp256k1 < secp256k1:: All > , best_block_height : u32 , logger : & L ,
@@ -896,7 +896,7 @@ impl OutboundPayments {
896
896
> (
897
897
& self , payment_id : PaymentId , payment_hash : PaymentHash ,
898
898
keysend_preimage : Option < PaymentPreimage > , invoice_request : Option < & InvoiceRequest > ,
899
- mut route_params : RouteParameters , retry_strategy : Retry , router : & R ,
899
+ mut route_params : RouteParameters , retry_strategy : Retry , router : R ,
900
900
first_hops : Vec < ChannelDetails > , inflight_htlcs : IH , entropy_source : & ES , node_signer : & NS ,
901
901
node_id_lookup : & NL , secp_ctx : & Secp256k1 < secp256k1:: All > , best_block_height : u32 , logger : & L ,
902
902
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > ,
@@ -936,8 +936,8 @@ impl OutboundPayments {
936
936
} ;
937
937
let route = match self . find_initial_route (
938
938
payment_id, payment_hash, & recipient_onion, keysend_preimage, invoice_request,
939
- & mut route_params, router, & first_hops, & inflight_htlcs, node_signer, best_block_height ,
940
- logger,
939
+ & mut route_params, router. deref ( ) , & first_hops, & inflight_htlcs, node_signer,
940
+ best_block_height , logger,
941
941
) {
942
942
Ok ( route) => route,
943
943
Err ( e) => {
@@ -1085,7 +1085,7 @@ impl OutboundPayments {
1085
1085
pub ( super ) fn send_payment_for_static_invoice <
1086
1086
R : Deref , ES : Deref , NS : Deref , NL : Deref , IH , SP , L : Deref
1087
1087
> (
1088
- & self , payment_id : PaymentId , router : & R , first_hops : Vec < ChannelDetails > , inflight_htlcs : IH ,
1088
+ & self , payment_id : PaymentId , router : R , first_hops : Vec < ChannelDetails > , inflight_htlcs : IH ,
1089
1089
entropy_source : & ES , node_signer : & NS , node_id_lookup : & NL ,
1090
1090
secp_ctx : & Secp256k1 < secp256k1:: All > , best_block_height : u32 , logger : & L ,
1091
1091
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > ,
@@ -1122,7 +1122,7 @@ impl OutboundPayments {
1122
1122
}
1123
1123
1124
1124
pub ( super ) fn check_retry_payments < R : Deref , ES : Deref , NS : Deref , SP , IH , FH , L : Deref > (
1125
- & self , router : & R , first_hops : FH , inflight_htlcs : IH , entropy_source : & ES , node_signer : & NS ,
1125
+ & self , router : R , first_hops : FH , inflight_htlcs : IH , entropy_source : & ES , node_signer : & NS ,
1126
1126
best_block_height : u32 ,
1127
1127
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > , logger : & L ,
1128
1128
send_payment_along_path : SP ,
@@ -1156,7 +1156,7 @@ impl OutboundPayments {
1156
1156
}
1157
1157
core:: mem:: drop ( outbounds) ;
1158
1158
if let Some ( ( payment_hash, payment_id, route_params) ) = retry_id_route_params {
1159
- 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)
1159
+ 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)
1160
1160
} else { break }
1161
1161
}
1162
1162
@@ -1188,7 +1188,7 @@ impl OutboundPayments {
1188
1188
fn find_initial_route < R : Deref , NS : Deref , IH , L : Deref > (
1189
1189
& self , payment_id : PaymentId , payment_hash : PaymentHash , recipient_onion : & RecipientOnionFields ,
1190
1190
keysend_preimage : Option < PaymentPreimage > , invoice_request : Option < & InvoiceRequest > ,
1191
- route_params : & mut RouteParameters , router : & R , first_hops : & Vec < ChannelDetails > ,
1191
+ route_params : & mut RouteParameters , router : R , first_hops : & Vec < ChannelDetails > ,
1192
1192
inflight_htlcs : & IH , node_signer : & NS , best_block_height : u32 , logger : & L ,
1193
1193
) -> Result < Route , RetryableSendFailure >
1194
1194
where
@@ -1242,7 +1242,7 @@ impl OutboundPayments {
1242
1242
fn send_payment_internal < R : Deref , NS : Deref , ES : Deref , IH , SP , L : Deref > (
1243
1243
& self , payment_id : PaymentId , payment_hash : PaymentHash , recipient_onion : RecipientOnionFields ,
1244
1244
keysend_preimage : Option < PaymentPreimage > , retry_strategy : Retry , mut route_params : RouteParameters ,
1245
- router : & R , first_hops : Vec < ChannelDetails > , inflight_htlcs : IH , entropy_source : & ES ,
1245
+ router : R , first_hops : Vec < ChannelDetails > , inflight_htlcs : IH , entropy_source : & ES ,
1246
1246
node_signer : & NS , best_block_height : u32 , logger : & L ,
1247
1247
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > , send_payment_along_path : SP ,
1248
1248
) -> Result < ( ) , RetryableSendFailure >
@@ -1255,8 +1255,8 @@ impl OutboundPayments {
1255
1255
SP : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
1256
1256
{
1257
1257
let route = self . find_initial_route (
1258
- payment_id, payment_hash, & recipient_onion, keysend_preimage, None , & mut route_params, router ,
1259
- & first_hops, & inflight_htlcs, node_signer, best_block_height, logger,
1258
+ payment_id, payment_hash, & recipient_onion, keysend_preimage, None , & mut route_params,
1259
+ router . deref ( ) , & first_hops, & inflight_htlcs, node_signer, best_block_height, logger,
1260
1260
) ?;
1261
1261
1262
1262
let onion_session_privs = self . add_new_pending_payment ( payment_hash,
@@ -1281,7 +1281,7 @@ impl OutboundPayments {
1281
1281
1282
1282
fn find_route_and_send_payment < R : Deref , NS : Deref , ES : Deref , IH , SP , L : Deref > (
1283
1283
& self , payment_hash : PaymentHash , payment_id : PaymentId , route_params : RouteParameters ,
1284
- router : & R , first_hops : Vec < ChannelDetails > , inflight_htlcs : & IH , entropy_source : & ES ,
1284
+ router : R , first_hops : Vec < ChannelDetails > , inflight_htlcs : & IH , entropy_source : & ES ,
1285
1285
node_signer : & NS , best_block_height : u32 , logger : & L ,
1286
1286
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > , send_payment_along_path : & SP ,
1287
1287
)
@@ -1436,7 +1436,7 @@ impl OutboundPayments {
1436
1436
1437
1437
fn handle_pay_route_err < R : Deref , NS : Deref , ES : Deref , IH , SP , L : Deref > (
1438
1438
& self , err : PaymentSendFailure , payment_id : PaymentId , payment_hash : PaymentHash , route : Route ,
1439
- mut route_params : RouteParameters , router : & R , first_hops : Vec < ChannelDetails > ,
1439
+ mut route_params : RouteParameters , router : R , first_hops : Vec < ChannelDetails > ,
1440
1440
inflight_htlcs : & IH , entropy_source : & ES , node_signer : & NS , best_block_height : u32 , logger : & L ,
1441
1441
pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > , send_payment_along_path : & SP ,
1442
1442
)
@@ -2491,7 +2491,7 @@ mod tests {
2491
2491
Some ( Retry :: Attempts ( 1 ) ) , Some ( expired_route_params. payment_params . clone ( ) ) ,
2492
2492
& & keys_manager, 0 ) . unwrap ( ) ;
2493
2493
outbound_payments. find_route_and_send_payment (
2494
- PaymentHash ( [ 0 ; 32 ] ) , PaymentId ( [ 0 ; 32 ] ) , expired_route_params, & & router, vec ! [ ] ,
2494
+ PaymentHash ( [ 0 ; 32 ] ) , PaymentId ( [ 0 ; 32 ] ) , expired_route_params, & router, vec ! [ ] ,
2495
2495
& || InFlightHtlcs :: new ( ) , & & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2496
2496
& |_| Ok ( ( ) ) ) ;
2497
2497
let events = pending_events. lock ( ) . unwrap ( ) ;
@@ -2502,7 +2502,7 @@ mod tests {
2502
2502
} else {
2503
2503
let err = outbound_payments. send_payment (
2504
2504
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 0 ; 32 ] ) ,
2505
- Retry :: Attempts ( 0 ) , expired_route_params, & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2505
+ Retry :: Attempts ( 0 ) , expired_route_params, & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2506
2506
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events, |_| Ok ( ( ) ) ) . unwrap_err ( ) ;
2507
2507
if let RetryableSendFailure :: PaymentExpired = err { } else { panic ! ( "Unexpected error" ) ; }
2508
2508
}
@@ -2535,7 +2535,7 @@ mod tests {
2535
2535
Some ( Retry :: Attempts ( 1 ) ) , Some ( route_params. payment_params . clone ( ) ) ,
2536
2536
& & keys_manager, 0 ) . unwrap ( ) ;
2537
2537
outbound_payments. find_route_and_send_payment (
2538
- PaymentHash ( [ 0 ; 32 ] ) , PaymentId ( [ 0 ; 32 ] ) , route_params, & & router, vec ! [ ] ,
2538
+ PaymentHash ( [ 0 ; 32 ] ) , PaymentId ( [ 0 ; 32 ] ) , route_params, & router, vec ! [ ] ,
2539
2539
& || InFlightHtlcs :: new ( ) , & & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2540
2540
& |_| Ok ( ( ) ) ) ;
2541
2541
let events = pending_events. lock ( ) . unwrap ( ) ;
@@ -2544,7 +2544,7 @@ mod tests {
2544
2544
} else {
2545
2545
let err = outbound_payments. send_payment (
2546
2546
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 0 ; 32 ] ) ,
2547
- Retry :: Attempts ( 0 ) , route_params, & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2547
+ Retry :: Attempts ( 0 ) , route_params, & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2548
2548
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events, |_| Ok ( ( ) ) ) . unwrap_err ( ) ;
2549
2549
if let RetryableSendFailure :: RouteNotFound = err {
2550
2550
} else { panic ! ( "Unexpected error" ) ; }
@@ -2592,7 +2592,7 @@ mod tests {
2592
2592
let pending_events = Mutex :: new ( VecDeque :: new ( ) ) ;
2593
2593
outbound_payments. send_payment (
2594
2594
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 0 ; 32 ] ) ,
2595
- Retry :: Attempts ( 0 ) , route_params. clone ( ) , & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2595
+ Retry :: Attempts ( 0 ) , route_params. clone ( ) , & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2596
2596
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2597
2597
|_| Err ( APIError :: ChannelUnavailable { err : "test" . to_owned ( ) } ) ) . unwrap ( ) ;
2598
2598
let mut events = pending_events. lock ( ) . unwrap ( ) ;
@@ -2610,15 +2610,15 @@ mod tests {
2610
2610
// Ensure that a MonitorUpdateInProgress "error" will not result in a PaymentPathFailed event.
2611
2611
outbound_payments. send_payment (
2612
2612
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 0 ; 32 ] ) ,
2613
- Retry :: Attempts ( 0 ) , route_params. clone ( ) , & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2613
+ Retry :: Attempts ( 0 ) , route_params. clone ( ) , & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2614
2614
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2615
2615
|_| Err ( APIError :: MonitorUpdateInProgress ) ) . unwrap ( ) ;
2616
2616
assert_eq ! ( pending_events. lock( ) . unwrap( ) . len( ) , 0 ) ;
2617
2617
2618
2618
// Ensure that any other error will result in a PaymentPathFailed event but no blamed scid.
2619
2619
outbound_payments. send_payment (
2620
2620
PaymentHash ( [ 0 ; 32 ] ) , RecipientOnionFields :: spontaneous_empty ( ) , PaymentId ( [ 1 ; 32 ] ) ,
2621
- Retry :: Attempts ( 0 ) , route_params. clone ( ) , & & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2621
+ Retry :: Attempts ( 0 ) , route_params. clone ( ) , & router, vec ! [ ] , || InFlightHtlcs :: new ( ) ,
2622
2622
& & keys_manager, & & keys_manager, 0 , & & logger, & pending_events,
2623
2623
|_| Err ( APIError :: APIMisuseError { err : "test" . to_owned ( ) } ) ) . unwrap ( ) ;
2624
2624
let events = pending_events. lock ( ) . unwrap ( ) ;
@@ -2804,7 +2804,7 @@ mod tests {
2804
2804
2805
2805
assert_eq ! (
2806
2806
outbound_payments. send_payment_for_bolt12_invoice(
2807
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2807
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2808
2808
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2809
2809
& secp_ctx, 0 , &&logger, & pending_events, |_| panic!( )
2810
2810
) ,
@@ -2866,7 +2866,7 @@ mod tests {
2866
2866
2867
2867
assert_eq ! (
2868
2868
outbound_payments. send_payment_for_bolt12_invoice(
2869
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2869
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2870
2870
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2871
2871
& secp_ctx, 0 , &&logger, & pending_events, |_| panic!( )
2872
2872
) ,
@@ -2941,7 +2941,7 @@ mod tests {
2941
2941
assert ! ( !outbound_payments. has_pending_payments( ) ) ;
2942
2942
assert_eq ! (
2943
2943
outbound_payments. send_payment_for_bolt12_invoice(
2944
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2944
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2945
2945
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2946
2946
& secp_ctx, 0 , &&logger, & pending_events, |_| panic!( )
2947
2947
) ,
@@ -2959,7 +2959,7 @@ mod tests {
2959
2959
2960
2960
assert_eq ! (
2961
2961
outbound_payments. send_payment_for_bolt12_invoice(
2962
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2962
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2963
2963
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2964
2964
& secp_ctx, 0 , &&logger, & pending_events, |_| Ok ( ( ) )
2965
2965
) ,
@@ -2970,7 +2970,7 @@ mod tests {
2970
2970
2971
2971
assert_eq ! (
2972
2972
outbound_payments. send_payment_for_bolt12_invoice(
2973
- & invoice, payment_id, && router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2973
+ & invoice, payment_id, & router, vec![ ] , Bolt12InvoiceFeatures :: empty( ) ,
2974
2974
|| InFlightHtlcs :: new( ) , &&keys_manager, &&keys_manager, & EmptyNodeIdLookUp { } ,
2975
2975
& secp_ctx, 0 , &&logger, & pending_events, |_| panic!( )
2976
2976
) ,
0 commit comments