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