@@ -537,6 +537,11 @@ pub struct PaymentParameters {
537
537
/// Default value: 2
538
538
pub max_channel_saturation_power_of_half : u8 ,
539
539
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
+
540
545
/// A list of SCIDs which this payment was previously attempted over and which caused the
541
546
/// payment to fail. Future attempts for the same payment shouldn't be relayed through any of
542
547
/// these SCIDs.
@@ -562,6 +567,7 @@ impl Writeable for PaymentParameters {
562
567
( 7 , self . previously_failed_channels, required_vec) ,
563
568
( 8 , * blinded_hints, optional_vec) ,
564
569
( 9 , self . payee. final_cltv_expiry_delta( ) , option) ,
570
+ ( 11 , self . max_total_routing_fee_msat, option) ,
565
571
} ) ;
566
572
Ok ( ( ) )
567
573
}
@@ -580,6 +586,7 @@ impl ReadableArgs<u32> for PaymentParameters {
580
586
( 7 , previously_failed_channels, optional_vec) ,
581
587
( 8 , blinded_route_hints, optional_vec) ,
582
588
( 9 , final_cltv_expiry_delta, ( default_value, default_final_cltv_expiry_delta) ) ,
589
+ ( 11 , max_total_routing_fee_msat, option) ,
583
590
} ) ;
584
591
let blinded_route_hints = blinded_route_hints. unwrap_or ( vec ! [ ] ) ;
585
592
let payee = if blinded_route_hints. len ( ) != 0 {
@@ -603,6 +610,7 @@ impl ReadableArgs<u32> for PaymentParameters {
603
610
max_channel_saturation_power_of_half : _init_tlv_based_struct_field ! ( max_channel_saturation_power_of_half, ( default_value, unused) ) ,
604
611
expiry_time,
605
612
previously_failed_channels : previously_failed_channels. unwrap_or ( Vec :: new ( ) ) ,
613
+ max_total_routing_fee_msat,
606
614
} )
607
615
}
608
616
}
@@ -621,6 +629,7 @@ impl PaymentParameters {
621
629
max_path_count : DEFAULT_MAX_PATH_COUNT ,
622
630
max_channel_saturation_power_of_half : DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF ,
623
631
previously_failed_channels : Vec :: new ( ) ,
632
+ max_total_routing_fee_msat : None ,
624
633
}
625
634
}
626
635
@@ -658,6 +667,7 @@ impl PaymentParameters {
658
667
max_path_count : DEFAULT_MAX_PATH_COUNT ,
659
668
max_channel_saturation_power_of_half : DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF ,
660
669
previously_failed_channels : Vec :: new ( ) ,
670
+ max_total_routing_fee_msat : None ,
661
671
}
662
672
}
663
673
@@ -733,6 +743,13 @@ impl PaymentParameters {
733
743
pub fn with_max_channel_saturation_power_of_half ( self , max_channel_saturation_power_of_half : u8 ) -> Self {
734
744
Self { max_channel_saturation_power_of_half, ..self }
735
745
}
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
+ }
736
753
}
737
754
738
755
/// The recipient of a payment, differing based on whether they've hidden their identity with route
0 commit comments