@@ -829,7 +829,7 @@ impl OutboundPayments {
829
829
PendingOutboundPayment :: AwaitingInvoice {
830
830
retry_strategy : retry, max_total_routing_fee_msat : max_total_fee, ..
831
831
} => {
832
- retry_strategy = Some ( * retry) ;
832
+ retry_strategy = * retry;
833
833
max_total_routing_fee_msat = * max_total_fee;
834
834
* entry. into_mut ( ) = PendingOutboundPayment :: InvoiceReceived {
835
835
payment_hash,
@@ -849,11 +849,41 @@ impl OutboundPayments {
849
849
return Err ( Bolt12PaymentError :: UnknownRequiredFeatures ) ;
850
850
}
851
851
852
- let mut payment_params = PaymentParameters :: from_bolt12_invoice ( & invoice) ;
852
+ let mut route_params = RouteParameters :: from_payment_params_and_value (
853
+ PaymentParameters :: from_bolt12_invoice ( & invoice) , invoice. amount_msats ( )
854
+ ) ;
855
+ if let Some ( max_fee_msat) = max_total_routing_fee_msat {
856
+ route_params. max_total_routing_fee_msat = Some ( max_fee_msat) ;
857
+ }
858
+ self . send_payment_for_bolt12_invoice_internal (
859
+ payment_id, payment_hash, route_params, retry_strategy, router, first_hops, inflight_htlcs,
860
+ entropy_source, node_signer, node_id_lookup, secp_ctx, best_block_height, logger,
861
+ pending_events, send_payment_along_path
862
+ )
863
+ }
853
864
865
+ fn send_payment_for_bolt12_invoice_internal <
866
+ R : Deref , ES : Deref , NS : Deref , NL : Deref , IH , SP , L : Deref
867
+ > (
868
+ & self , payment_id : PaymentId , payment_hash : PaymentHash , mut route_params : RouteParameters ,
869
+ retry_strategy : Retry , router : & R , first_hops : Vec < ChannelDetails > , inflight_htlcs : IH ,
870
+ entropy_source : & ES , node_signer : & NS , node_id_lookup : & NL ,
871
+ secp_ctx : & Secp256k1 < secp256k1:: All > , best_block_height : u32 , logger : & L ,
872
+ pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > ,
873
+ send_payment_along_path : SP ,
874
+ ) -> Result < ( ) , Bolt12PaymentError >
875
+ where
876
+ R :: Target : Router ,
877
+ ES :: Target : EntropySource ,
878
+ NS :: Target : NodeSigner ,
879
+ NL :: Target : NodeIdLookUp ,
880
+ L :: Target : Logger ,
881
+ IH : Fn ( ) -> InFlightHtlcs ,
882
+ SP : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
883
+ {
854
884
// Advance any blinded path where the introduction node is our node.
855
885
if let Ok ( our_node_id) = node_signer. get_node_id ( Recipient :: Node ) {
856
- for path in payment_params. payee . blinded_route_hints_mut ( ) . iter_mut ( ) {
886
+ for path in route_params . payment_params . payee . blinded_route_hints_mut ( ) . iter_mut ( ) {
857
887
let introduction_node_id = match path. introduction_node ( ) {
858
888
IntroductionNode :: NodeId ( pubkey) => * pubkey,
859
889
IntroductionNode :: DirectedShortChannelId ( direction, scid) => {
@@ -869,15 +899,6 @@ impl OutboundPayments {
869
899
}
870
900
}
871
901
872
- let amount_msat = invoice. amount_msats ( ) ;
873
- let mut route_params = RouteParameters :: from_payment_params_and_value (
874
- payment_params, amount_msat
875
- ) ;
876
-
877
- if let Some ( max_fee_msat) = max_total_routing_fee_msat {
878
- route_params. max_total_routing_fee_msat = Some ( max_fee_msat) ;
879
- }
880
-
881
902
let recipient_onion = RecipientOnionFields {
882
903
payment_secret : None ,
883
904
payment_metadata : None ,
@@ -902,8 +923,8 @@ impl OutboundPayments {
902
923
903
924
let payment_params = Some ( route_params. payment_params . clone ( ) ) ;
904
925
let ( retryable_payment, onion_session_privs) = self . create_pending_payment (
905
- payment_hash, recipient_onion. clone ( ) , None , & route,
906
- retry_strategy , payment_params , entropy_source, best_block_height
926
+ payment_hash, recipient_onion. clone ( ) , None , & route, Some ( retry_strategy ) , payment_params ,
927
+ entropy_source, best_block_height
907
928
) ;
908
929
match self . pending_outbound_payments . lock ( ) . unwrap ( ) . entry ( payment_id) {
909
930
hash_map:: Entry :: Occupied ( entry) => match entry. get ( ) {
0 commit comments