@@ -851,7 +851,7 @@ impl OutboundPayments {
851
851
SP : Fn ( SendAlongPathArgs ) -> Result < ( ) , APIError > ,
852
852
{
853
853
let payment_hash = invoice. payment_hash ( ) ;
854
- let max_total_routing_fee_msat ;
854
+ let params_config ;
855
855
let retry_strategy;
856
856
match self . pending_outbound_payments . lock ( ) . unwrap ( ) . entry ( payment_id) {
857
857
hash_map:: Entry :: Occupied ( entry) => match entry. get ( ) {
@@ -860,14 +860,17 @@ impl OutboundPayments {
860
860
} => {
861
861
retry_strategy = * retry;
862
862
// 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;
866
869
* entry. into_mut ( ) = PendingOutboundPayment :: InvoiceReceived {
867
870
payment_hash,
868
871
retry_strategy : * retry,
869
872
max_total_routing_fee_msat : * max_total_fee,
870
- route_params_config : route_params_config ,
873
+ route_params_config,
871
874
} ;
872
875
} ,
873
876
_ => return Err ( Bolt12PaymentError :: DuplicateInvoice ) ,
@@ -883,11 +886,11 @@ impl OutboundPayments {
883
886
}
884
887
885
888
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 ( )
887
890
) ;
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
+
891
894
self . send_payment_for_bolt12_invoice_internal (
892
895
payment_id, payment_hash, None , route_params, retry_strategy, router, first_hops,
893
896
inflight_htlcs, entropy_source, node_signer, node_id_lookup, secp_ctx, best_block_height,
0 commit comments