@@ -686,6 +686,10 @@ pub struct PaymentParameters {
686
686
/// Defaults to [`DEFAULT_MAX_PATH_COUNT`].
687
687
pub max_path_count : u8 ,
688
688
689
+ /// The maximum number of [`Path::hops`] in any returned path, not counting the recipient hop.
690
+ /// Defaults to [`MAX_PATH_LENGTH_ESTIMATE`].
691
+ pub max_intermediate_hops : u8 ,
692
+
689
693
/// Selects the maximum share of a channel's total capacity which will be sent over a channel,
690
694
/// as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
691
695
/// a lower value prefers to send larger MPP parts, potentially saturating channels and
@@ -732,6 +736,7 @@ impl Writeable for PaymentParameters {
732
736
( 8 , * blinded_hints, optional_vec) ,
733
737
( 9 , self . payee. final_cltv_expiry_delta( ) , option) ,
734
738
( 11 , self . previously_failed_blinded_path_idxs, required_vec) ,
739
+ ( 13 , self . max_intermediate_hops, required) ,
735
740
} ) ;
736
741
Ok ( ( ) )
737
742
}
@@ -751,6 +756,7 @@ impl ReadableArgs<u32> for PaymentParameters {
751
756
( 8 , blinded_route_hints, optional_vec) ,
752
757
( 9 , final_cltv_expiry_delta, ( default_value, default_final_cltv_expiry_delta) ) ,
753
758
( 11 , previously_failed_blinded_path_idxs, optional_vec) ,
759
+ ( 13 , max_intermediate_hops, ( default_value, MAX_PATH_LENGTH_ESTIMATE ) ) ,
754
760
} ) ;
755
761
let blinded_route_hints = blinded_route_hints. unwrap_or ( vec ! [ ] ) ;
756
762
let payee = if blinded_route_hints. len ( ) != 0 {
@@ -775,6 +781,7 @@ impl ReadableArgs<u32> for PaymentParameters {
775
781
expiry_time,
776
782
previously_failed_channels : previously_failed_channels. unwrap_or ( Vec :: new ( ) ) ,
777
783
previously_failed_blinded_path_idxs : previously_failed_blinded_path_idxs. unwrap_or ( Vec :: new ( ) ) ,
784
+ max_intermediate_hops : _init_tlv_based_struct_field ! ( max_intermediate_hops, ( default_value, unused) ) ,
778
785
} )
779
786
}
780
787
}
@@ -791,6 +798,7 @@ impl PaymentParameters {
791
798
expiry_time : None ,
792
799
max_total_cltv_expiry_delta : DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA ,
793
800
max_path_count : DEFAULT_MAX_PATH_COUNT ,
801
+ max_intermediate_hops : MAX_PATH_LENGTH_ESTIMATE ,
794
802
max_channel_saturation_power_of_half : DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF ,
795
803
previously_failed_channels : Vec :: new ( ) ,
796
804
previously_failed_blinded_path_idxs : Vec :: new ( ) ,
@@ -830,6 +838,7 @@ impl PaymentParameters {
830
838
expiry_time : None ,
831
839
max_total_cltv_expiry_delta : DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA ,
832
840
max_path_count : DEFAULT_MAX_PATH_COUNT ,
841
+ max_intermediate_hops : MAX_PATH_LENGTH_ESTIMATE ,
833
842
max_channel_saturation_power_of_half : DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF ,
834
843
previously_failed_channels : Vec :: new ( ) ,
835
844
previously_failed_blinded_path_idxs : Vec :: new ( ) ,
0 commit comments