@@ -83,7 +83,11 @@ fn mpp_retry() {
8383 send_payment ( & nodes[ 3 ] , & vec ! ( & nodes[ 2 ] ) [ ..] , 1_500_000 ) ;
8484
8585 let amt_msat = 1_000_000 ;
86- let ( mut route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 3 ] , amt_msat) ;
86+ let max_total_routing_fee_msat = 50_000 ;
87+ let payment_params = PaymentParameters :: from_node_id ( nodes[ 3 ] . node . get_our_node_id ( ) , TEST_FINAL_CLTV )
88+ . with_bolt11_features ( nodes[ 3 ] . node . invoice_features ( ) ) . unwrap ( ) ;
89+ let ( mut route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash ! (
90+ nodes[ 0 ] , nodes[ 3 ] , payment_params, amt_msat, Some ( max_total_routing_fee_msat) ) ;
8791 let path = route. paths [ 0 ] . clone ( ) ;
8892 route. paths . push ( path) ;
8993 route. paths [ 0 ] . hops [ 0 ] . pubkey = nodes[ 1 ] . node . get_our_node_id ( ) ;
@@ -150,6 +154,9 @@ fn mpp_retry() {
150154 route. paths . remove ( 0 ) ;
151155 route_params. final_value_msat = 1_000_000 ;
152156 route_params. payment_params . previously_failed_channels . push ( chan_4_update. contents . short_channel_id ) ;
157+ // Check the remaining max total routing fee for the second attempt is 50_000 - 1_000 msat fee
158+ // used by the first path
159+ route_params. max_total_routing_fee_msat = Some ( max_total_routing_fee_msat - 1_000 ) ;
153160 nodes[ 0 ] . router . expect_find_route ( route_params, Ok ( route) ) ;
154161 nodes[ 0 ] . node . process_pending_htlc_forwards ( ) ;
155162 check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
0 commit comments