@@ -875,7 +875,7 @@ impl OutboundPayments {
875875 }
876876 }
877877
878- let route = router. find_route_with_id (
878+ let mut route = router. find_route_with_id (
879879 & node_signer. get_node_id ( Recipient :: Node ) . unwrap ( ) , & route_params,
880880 Some ( & first_hops. iter ( ) . collect :: < Vec < _ > > ( ) ) , inflight_htlcs ( ) ,
881881 payment_hash, payment_id,
@@ -885,6 +885,14 @@ impl OutboundPayments {
885885 RetryableSendFailure :: RouteNotFound
886886 } ) ?;
887887
888+ if let Some ( route_route_params) = route. route_params . as_mut ( ) {
889+ if route_route_params. final_value_msat != route_params. final_value_msat {
890+ debug_assert ! ( false ,
891+ "Routers are expected to return a route which includes the requested final_value_msat" ) ;
892+ route_route_params. final_value_msat = route_params. final_value_msat ;
893+ }
894+ }
895+
888896 let onion_session_privs = self . add_new_pending_payment ( payment_hash,
889897 recipient_onion. clone ( ) , payment_id, keysend_preimage, & route, Some ( retry_strategy) ,
890898 Some ( route_params. payment_params . clone ( ) ) , entropy_source, best_block_height)
@@ -926,7 +934,7 @@ impl OutboundPayments {
926934 }
927935 }
928936
929- let route = match router. find_route_with_id (
937+ let mut route = match router. find_route_with_id (
930938 & node_signer. get_node_id ( Recipient :: Node ) . unwrap ( ) , & route_params,
931939 Some ( & first_hops. iter ( ) . collect :: < Vec < _ > > ( ) ) , inflight_htlcs ( ) ,
932940 payment_hash, payment_id,
@@ -938,6 +946,15 @@ impl OutboundPayments {
938946 return
939947 }
940948 } ;
949+
950+ if let Some ( route_route_params) = route. route_params . as_mut ( ) {
951+ if route_route_params. final_value_msat != route_params. final_value_msat {
952+ debug_assert ! ( false ,
953+ "Routers are expected to return a route which includes the requested final_value_msat" ) ;
954+ route_route_params. final_value_msat = route_params. final_value_msat ;
955+ }
956+ }
957+
941958 for path in route. paths . iter ( ) {
942959 if path. hops . len ( ) == 0 {
943960 log_error ! ( logger, "Unusable path in route (path.hops.len() must be at least 1" ) ;
0 commit comments