@@ -537,6 +537,14 @@ 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
+ /// This limit also applies to the total fees that may arise while retrying partially failed
543
+ /// payments.
544
+ ///
545
+ /// Default value: `None`
546
+ pub max_total_routing_fee_msat : Option < u64 > ,
547
+
540
548
/// A list of SCIDs which this payment was previously attempted over and which caused the
541
549
/// payment to fail. Future attempts for the same payment shouldn't be relayed through any of
542
550
/// these SCIDs.
@@ -562,6 +570,7 @@ impl Writeable for PaymentParameters {
562
570
( 7 , self . previously_failed_channels, required_vec) ,
563
571
( 8 , * blinded_hints, optional_vec) ,
564
572
( 9 , self . payee. final_cltv_expiry_delta( ) , option) ,
573
+ ( 11 , self . max_total_routing_fee_msat, option) ,
565
574
} ) ;
566
575
Ok ( ( ) )
567
576
}
@@ -580,6 +589,7 @@ impl ReadableArgs<u32> for PaymentParameters {
580
589
( 7 , previously_failed_channels, optional_vec) ,
581
590
( 8 , blinded_route_hints, optional_vec) ,
582
591
( 9 , final_cltv_expiry_delta, ( default_value, default_final_cltv_expiry_delta) ) ,
592
+ ( 11 , max_total_routing_fee_msat, option) ,
583
593
} ) ;
584
594
let blinded_route_hints = blinded_route_hints. unwrap_or ( vec ! [ ] ) ;
585
595
let payee = if blinded_route_hints. len ( ) != 0 {
@@ -603,6 +613,7 @@ impl ReadableArgs<u32> for PaymentParameters {
603
613
max_channel_saturation_power_of_half : _init_tlv_based_struct_field ! ( max_channel_saturation_power_of_half, ( default_value, unused) ) ,
604
614
expiry_time,
605
615
previously_failed_channels : previously_failed_channels. unwrap_or ( Vec :: new ( ) ) ,
616
+ max_total_routing_fee_msat,
606
617
} )
607
618
}
608
619
}
@@ -621,6 +632,7 @@ impl PaymentParameters {
621
632
max_path_count : DEFAULT_MAX_PATH_COUNT ,
622
633
max_channel_saturation_power_of_half : DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF ,
623
634
previously_failed_channels : Vec :: new ( ) ,
635
+ max_total_routing_fee_msat : None ,
624
636
}
625
637
}
626
638
@@ -658,6 +670,7 @@ impl PaymentParameters {
658
670
max_path_count : DEFAULT_MAX_PATH_COUNT ,
659
671
max_channel_saturation_power_of_half : DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF ,
660
672
previously_failed_channels : Vec :: new ( ) ,
673
+ max_total_routing_fee_msat : None ,
661
674
}
662
675
}
663
676
@@ -733,6 +746,13 @@ impl PaymentParameters {
733
746
pub fn with_max_channel_saturation_power_of_half ( self , max_channel_saturation_power_of_half : u8 ) -> Self {
734
747
Self { max_channel_saturation_power_of_half, ..self }
735
748
}
749
+
750
+ /// Includes a limit for the maximum total routing fees that may accrue during route finding.
751
+ ///
752
+ /// This is not exported to bindings users since bindings don't support move semantics
753
+ pub fn with_max_total_routing_fee_msat ( self , max_total_routing_fee_msat : u64 ) -> Self {
754
+ Self { max_total_routing_fee_msat : Some ( max_total_routing_fee_msat) , ..self }
755
+ }
736
756
}
737
757
738
758
/// The recipient of a payment, differing based on whether they've hidden their identity with route
0 commit comments