@@ -851,7 +851,7 @@ impl OutboundPayments {
851851 SP : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
852852 {
853853 let payment_hash = invoice. payment_hash ( ) ;
854- let max_total_routing_fee_msat ;
854+ let params_config ;
855855 let retry_strategy;
856856 match self . pending_outbound_payments . lock ( ) . unwrap ( ) . entry ( payment_id) {
857857 hash_map:: Entry :: Occupied ( entry) => match entry. get ( ) {
@@ -860,14 +860,17 @@ impl OutboundPayments {
860860 } => {
861861 retry_strategy = * retry;
862862 // If max_total_fee is present, update route_params_config with the specified fee.
863- // This supports the standard behavior during downgrades.
864- let route_params_config = max_total_fee. map_or ( * route_params_config, |fee_msat| route_params_config. with_max_total_routing_fee_msat ( fee_msat) ) ;
865- max_total_routing_fee_msat = route_params_config. max_total_routing_fee_msat ;
863+ // This supports the standard behavior during downgrades.
864+ let route_params_config = max_total_fee. map_or (
865+ * route_params_config,
866+ |fee_msat| route_params_config. with_max_total_routing_fee_msat ( fee_msat) ,
867+ ) ;
868+ params_config = route_params_config;
866869 * entry. into_mut ( ) = PendingOutboundPayment :: InvoiceReceived {
867870 payment_hash,
868871 retry_strategy : * retry,
869872 max_total_routing_fee_msat : * max_total_fee,
870- route_params_config : route_params_config ,
873+ route_params_config,
871874 } ;
872875 } ,
873876 _ => return Err ( Bolt12PaymentError :: DuplicateInvoice ) ,
@@ -883,11 +886,11 @@ impl OutboundPayments {
883886 }
884887
885888 let mut route_params = RouteParameters :: from_payment_params_and_value (
886- PaymentParameters :: from_bolt12_invoice ( & invoice) , invoice. amount_msats ( )
889+ PaymentParameters :: from_bolt12_invoice ( & invoice) . with_user_config ( params_config ) , invoice. amount_msats ( )
887890 ) ;
888- if let Some ( max_fee_msat ) = max_total_routing_fee_msat {
889- route_params. max_total_routing_fee_msat = Some ( max_fee_msat ) ;
890- }
891+
892+ params_config . max_total_routing_fee_msat . map ( |fee_msat| route_params. max_total_routing_fee_msat = Some ( fee_msat ) ) ;
893+
891894 self . send_payment_for_bolt12_invoice_internal (
892895 payment_id, payment_hash, None , route_params, retry_strategy, router, first_hops,
893896 inflight_htlcs, entropy_source, node_signer, node_id_lookup, secp_ctx, best_block_height,
0 commit comments