@@ -1030,6 +1030,93 @@ impl PaymentParameters {
10301030	} 
10311031} 
10321032
1033+ /// A struct for configuring parameters for routing the payment. 
1034+ #[ derive( Clone ,  Copy ) ]  
1035+ pub  struct  RouteParametersConfig  { 
1036+ 	/// The maximum total fees, in millisatoshi, that may accrue during route finding. 
1037+ /// 
1038+ /// This limit also applies to the total fees that may arise while retrying failed payment 
1039+ /// paths. 
1040+ /// 
1041+ /// Note that values below a few sats may result in some paths being spuriously ignored. 
1042+ /// 
1043+ /// Defaults to 1% of the payment amount + 50 sats 
1044+ pub  max_total_routing_fee_msat :  Option < u64 > , 
1045+ 
1046+ 	/// The maximum total CLTV delta we accept for the route. 
1047+ /// Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. 
1048+ pub  max_total_cltv_expiry_delta :  u32 , 
1049+ 
1050+ 	/// The maximum number of paths that may be used by (MPP) payments. 
1051+ /// Defaults to [`DEFAULT_MAX_PATH_COUNT`]. 
1052+ pub  max_path_count :  u8 , 
1053+ 
1054+ 	/// Selects the maximum share of a channel's total capacity which will be sent over a channel, 
1055+ /// as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas 
1056+ /// a lower value prefers to send larger MPP parts, potentially saturating channels and 
1057+ /// increasing failure probability for those paths. 
1058+ /// 
1059+ /// Note that this restriction will be relaxed during pathfinding after paths which meet this 
1060+ /// restriction have been found. While paths which meet this criteria will be searched for, it 
1061+ /// is ultimately up to the scorer to select them over other paths. 
1062+ /// 
1063+ /// A value of 0 will allow payments up to and including a channel's total announced usable 
1064+ /// capacity, a value of one will only use up to half its capacity, two 1/4, etc. 
1065+ /// 
1066+ /// Default value: 2 
1067+ pub  max_channel_saturation_power_of_half :  u8 , 
1068+ } 
1069+ 
1070+ impl_writeable_tlv_based ! ( RouteParametersConfig ,  { 
1071+ 	( 1 ,  max_total_routing_fee_msat,  option) , 
1072+ 	( 3 ,  max_total_cltv_expiry_delta,  required) , 
1073+ 	( 5 ,  max_path_count,  required) , 
1074+ 	( 7 ,  max_channel_saturation_power_of_half,  required) , 
1075+ } ) ; 
1076+ 
1077+ impl  RouteParametersConfig  { 
1078+ 	/// Set the maximum total fees, in millisatoshi, that may accrue during route finding. 
1079+ /// 
1080+ /// This is not exported to bindings users since bindings don't support move semantics 
1081+ pub  fn  with_max_total_routing_fee_msat ( self ,  fee_msat :  u64 )  -> Self  { 
1082+ 		Self  {  max_total_routing_fee_msat :  Some ( fee_msat) ,  ..self  } 
1083+ 	} 
1084+ 
1085+ 	/// Includes a limit for the total CLTV expiry delta which is considered during routing 
1086+ /// 
1087+ /// This is not exported to bindings users since bindings don't support move semantics 
1088+ pub  fn  with_max_total_cltv_expiry_delta ( self ,  max_total_cltv_expiry_delta :  u32 )  -> Self  { 
1089+ 		Self  {  max_total_cltv_expiry_delta,  ..self  } 
1090+ 	} 
1091+ 
1092+ 	/// Includes a limit for the maximum number of payment paths that may be used. 
1093+ /// 
1094+ /// This is not exported to bindings users since bindings don't support move semantics 
1095+ pub  fn  with_max_path_count ( self ,  max_path_count :  u8 )  -> Self  { 
1096+ 		Self  {  max_path_count,  ..self  } 
1097+ 	} 
1098+ 
1099+ 	/// Includes a limit for the maximum share of a channel's total capacity that can be sent over, as 
1100+ /// a power of 1/2. See [`PaymentParameters::max_channel_saturation_power_of_half`]. 
1101+ /// 
1102+ /// This is not exported to bindings users since bindings don't support move semantics 
1103+ pub  fn  with_max_channel_saturation_power_of_half ( self ,  max_channel_saturation_power_of_half :  u8 )  -> Self  { 
1104+ 		Self  {  max_channel_saturation_power_of_half,  ..self  } 
1105+ 	} 
1106+ } 
1107+ 
1108+ impl  Default  for  RouteParametersConfig  { 
1109+ 	/// Initates an new set of route parameter configs with default parameters. 
1110+ fn  default ( )  -> Self  { 
1111+ 		Self  { 
1112+ 			max_total_routing_fee_msat :  None , 
1113+ 			max_total_cltv_expiry_delta :  DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA , 
1114+ 			max_path_count :  DEFAULT_MAX_PATH_COUNT , 
1115+ 			max_channel_saturation_power_of_half :  DEFAULT_MAX_CHANNEL_SATURATION_POW_HALF , 
1116+ 		} 
1117+ 	} 
1118+ } 
1119+ 
10331120/// The recipient of a payment, differing based on whether they've hidden their identity with route 
10341121/// blinding. 
10351122#[ derive( Clone ,  Debug ,  Hash ,  PartialEq ,  Eq ) ]  
0 commit comments