@@ -537,6 +537,11 @@ pub struct PaymentParameters {
537537 /// Default value: 2
538538 pub max_channel_saturation_power_of_half : u8 ,
539539
540+ /// The maximum total fees, in millisatoshi, that may accrue during route finding.
541+ ///
542+ /// Default value: `None`
543+ pub max_total_routing_fee_msat : Option < u64 > ,
544+
540545 /// A list of SCIDs which this payment was previously attempted over and which caused the
541546 /// payment to fail. Future attempts for the same payment shouldn't be relayed through any of
542547 /// these SCIDs.
@@ -562,6 +567,7 @@ impl Writeable for PaymentParameters {
562567 ( 7 , self . previously_failed_channels, required_vec) ,
563568 ( 8 , * blinded_hints, optional_vec) ,
564569 ( 9 , self . payee. final_cltv_expiry_delta( ) , option) ,
570+ ( 11 , self . max_total_routing_fee_msat, option) ,
565571 } ) ;
566572 Ok ( ( ) )
567573 }
@@ -580,6 +586,7 @@ impl ReadableArgs<u32> for PaymentParameters {
580586 ( 7 , previously_failed_channels, optional_vec) ,
581587 ( 8 , blinded_route_hints, optional_vec) ,
582588 ( 9 , final_cltv_expiry_delta, ( default_value, default_final_cltv_expiry_delta) ) ,
589+ ( 11 , max_total_routing_fee_msat, option) ,
583590 } ) ;
584591 let blinded_route_hints = blinded_route_hints. unwrap_or ( vec ! [ ] ) ;
585592 let payee = if blinded_route_hints. len ( ) != 0 {
@@ -603,6 +610,7 @@ impl ReadableArgs<u32> for PaymentParameters {
603610 max_channel_saturation_power_of_half : _init_tlv_based_struct_field ! ( max_channel_saturation_power_of_half, ( default_value, unused) ) ,
604611 expiry_time,
605612 previously_failed_channels : previously_failed_channels. unwrap_or ( Vec :: new ( ) ) ,
613+ max_total_routing_fee_msat,
606614 } )
607615 }
608616}
@@ -621,6 +629,7 @@ impl PaymentParameters {
621629 max_path_count : DEFAULT_MAX_PATH_COUNT ,
622630 max_channel_saturation_power_of_half : DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF ,
623631 previously_failed_channels : Vec :: new ( ) ,
632+ max_total_routing_fee_msat : None ,
624633 }
625634 }
626635
@@ -658,6 +667,7 @@ impl PaymentParameters {
658667 max_path_count : DEFAULT_MAX_PATH_COUNT ,
659668 max_channel_saturation_power_of_half : DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF ,
660669 previously_failed_channels : Vec :: new ( ) ,
670+ max_total_routing_fee_msat : None ,
661671 }
662672 }
663673
@@ -733,6 +743,13 @@ impl PaymentParameters {
733743 pub fn with_max_channel_saturation_power_of_half ( self , max_channel_saturation_power_of_half : u8 ) -> Self {
734744 Self { max_channel_saturation_power_of_half, ..self }
735745 }
746+
747+ /// Includes a limit for the maximum total routing fees that may accrue during route finding.
748+ ///
749+ /// This is not exported to bindings users since bindings don't support move semantics
750+ pub fn with_max_total_routing_fee_msat ( self , max_total_routing_fee_msat : u64 ) -> Self {
751+ Self { max_total_routing_fee_msat : Some ( max_total_routing_fee_msat) , ..self }
752+ }
736753}
737754
738755/// The recipient of a payment, differing based on whether they've hidden their identity with route
0 commit comments