@@ -454,12 +454,13 @@ pub struct ProbabilisticScoringFeeParameters {
454454/// Default value: 500 msat 
455455pub  base_penalty_msat :  u64 , 
456456
457- 	/// A multiplier used with the payment  amount to calculate a fixed penalty applied to each  
458- /// channel, in excess of the [`base_penalty_msat`]. 
457+ 	/// A multiplier used with the total  amount flowing over a channel  to calculate a fixed penalty 
458+ /// applied to each  channel, in excess of the [`base_penalty_msat`]. 
459459/// 
460460/// The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., 
461461/// fees plus penalty) for large payments. The penalty is computed as the product of this 
462- /// multiplier and `2^30`ths of the payment amount. 
462+ /// multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment 
463+ /// amount plus the amount of any other HTLCs flowing we sent over the same channel). 
463464/// 
464465/// ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` 
465466/// 
@@ -486,9 +487,9 @@ pub struct ProbabilisticScoringFeeParameters {
486487/// [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life 
487488pub  liquidity_penalty_multiplier_msat :  u64 , 
488489
489- 	/// A multiplier used in conjunction with a payment  amount and the negative `log10` of  the 
490- /// channel's success probability for the payment, as determined by our latest estimates of the  
491- /// channel's liquidity, to determine the amount penalty. 
490+ 	/// A multiplier used in conjunction with the total  amount flowing over a channel and  the 
491+ /// negative `log10` of the  channel's success probability for the payment, as determined by our 
492+ /// latest estimates of the  channel's liquidity, to determine the amount penalty. 
492493/// 
493494/// The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., 
494495/// fees plus penalty) for large payments. The penalty is computed as the product of this 
@@ -522,9 +523,10 @@ pub struct ProbabilisticScoringFeeParameters {
522523/// [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat 
523524pub  historical_liquidity_penalty_multiplier_msat :  u64 , 
524525
525- 	/// A multiplier used in conjunction with the payment amount and the negative `log10` of the 
526- /// channel's success probability for the payment, as determined based on the history of our 
527- /// estimates of the channel's available liquidity, to determine a penalty. 
526+ 	/// A multiplier used in conjunction with the total amount flowing over a channel and the 
527+ /// negative `log10` of the channel's success probability for the payment, as determined based 
528+ /// on the history of our estimates of the channel's available liquidity, to determine a 
529+ /// penalty. 
528530/// 
529531/// The purpose of the amount penalty is to avoid having fees dominate the channel cost for 
530532/// large payments. The penalty is computed as the product of this multiplier and the `2^20`ths 
@@ -558,8 +560,9 @@ pub struct ProbabilisticScoringFeeParameters {
558560/// Default value: 250 msat 
559561pub  anti_probing_penalty_msat :  u64 , 
560562
561- 	/// This penalty is applied when the amount we're attempting to send over a channel exceeds our 
562- /// current estimate of the channel's available liquidity. 
563+ 	/// This penalty is applied when the total amount flowing over a channel exceeds our current 
564+ /// estimate of the channel's available liquidity. The total amount is the amount of the 
565+ /// current HTLC plus any HTLCs which we've sent over the same channel. 
563566/// 
564567/// Note that in this case all other penalties, including the 
565568/// [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based 
@@ -733,7 +736,6 @@ struct DirectedChannelLiquidity<L: Deref<Target = u64>, BRT: Deref<Target = Hist
733736	min_liquidity_offset_msat :  L , 
734737	max_liquidity_offset_msat :  L , 
735738	liquidity_history :  HistoricalMinMaxBuckets < BRT > , 
736- 	inflight_htlc_msat :  u64 , 
737739	capacity_msat :  u64 , 
738740	last_updated :  U , 
739741	now :  T , 
@@ -771,7 +773,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ProbabilisticScorerU
771773				let  log_direction = |source,  target| { 
772774					if  let  Some ( ( directed_info,  _) )  = chan_debug. as_directed_to ( target)  { 
773775						let  amt = directed_info. effective_capacity ( ) . as_msat ( ) ; 
774- 						let  dir_liq = liq. as_directed ( source,  target,  0 ,   amt,  self . decay_params ) ; 
776+ 						let  dir_liq = liq. as_directed ( source,  target,  amt,  self . decay_params ) ; 
775777
776778						let  ( min_buckets,  max_buckets)  = dir_liq. liquidity_history 
777779							. get_decayed_buckets ( now,  * dir_liq. last_updated , 
@@ -825,7 +827,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ProbabilisticScorerU
825827			if  let  Some ( liq)  = self . channel_liquidities . get ( & scid)  { 
826828				if  let  Some ( ( directed_info,  source) )  = chan. as_directed_to ( target)  { 
827829					let  amt = directed_info. effective_capacity ( ) . as_msat ( ) ; 
828- 					let  dir_liq = liq. as_directed ( source,  target,  0 ,   amt,  self . decay_params ) ; 
830+ 					let  dir_liq = liq. as_directed ( source,  target,  amt,  self . decay_params ) ; 
829831					return  Some ( ( dir_liq. min_liquidity_msat ( ) ,  dir_liq. max_liquidity_msat ( ) ) ) ; 
830832				} 
831833			} 
@@ -867,7 +869,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ProbabilisticScorerU
867869			if  let  Some ( liq)  = self . channel_liquidities . get ( & scid)  { 
868870				if  let  Some ( ( directed_info,  source) )  = chan. as_directed_to ( target)  { 
869871					let  amt = directed_info. effective_capacity ( ) . as_msat ( ) ; 
870- 					let  dir_liq = liq. as_directed ( source,  target,  0 ,   amt,  self . decay_params ) ; 
872+ 					let  dir_liq = liq. as_directed ( source,  target,  amt,  self . decay_params ) ; 
871873
872874					let  ( min_buckets,  mut  max_buckets)  =
873875						dir_liq. liquidity_history . get_decayed_buckets ( 
@@ -901,7 +903,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ProbabilisticScorerU
901903			if  let  Some ( liq)  = self . channel_liquidities . get ( & scid)  { 
902904				if  let  Some ( ( directed_info,  source) )  = chan. as_directed_to ( target)  { 
903905					let  capacity_msat = directed_info. effective_capacity ( ) . as_msat ( ) ; 
904- 					let  dir_liq = liq. as_directed ( source,  target,  0 ,   capacity_msat,  self . decay_params ) ; 
906+ 					let  dir_liq = liq. as_directed ( source,  target,  capacity_msat,  self . decay_params ) ; 
905907
906908					return  dir_liq. liquidity_history . calculate_success_probability_times_billion ( 
907909						dir_liq. now ,  * dir_liq. last_updated , 
@@ -930,7 +932,7 @@ impl<T: Time> ChannelLiquidity<T> {
930932	/// Returns a view of the channel liquidity directed from `source` to `target` assuming 
931933/// `capacity_msat`. 
932934fn  as_directed ( 
933- 		& self ,  source :  & NodeId ,  target :  & NodeId ,  inflight_htlc_msat :   u64 ,   capacity_msat :  u64 ,  decay_params :  ProbabilisticScoringDecayParameters 
935+ 		& self ,  source :  & NodeId ,  target :  & NodeId ,  capacity_msat :  u64 ,  decay_params :  ProbabilisticScoringDecayParameters 
934936	)  -> DirectedChannelLiquidity < & u64 ,  & HistoricalBucketRangeTracker ,  T ,  & T >  { 
935937		let  ( min_liquidity_offset_msat,  max_liquidity_offset_msat,  min_liquidity_offset_history,  max_liquidity_offset_history)  =
936938			if  source < target { 
@@ -948,7 +950,6 @@ impl<T: Time> ChannelLiquidity<T> {
948950				min_liquidity_offset_history, 
949951				max_liquidity_offset_history, 
950952			} , 
951- 			inflight_htlc_msat, 
952953			capacity_msat, 
953954			last_updated :  & self . last_updated , 
954955			now :  T :: now ( ) , 
@@ -959,7 +960,7 @@ impl<T: Time> ChannelLiquidity<T> {
959960	/// Returns a mutable view of the channel liquidity directed from `source` to `target` assuming 
960961/// `capacity_msat`. 
961962fn  as_directed_mut ( 
962- 		& mut  self ,  source :  & NodeId ,  target :  & NodeId ,  inflight_htlc_msat :   u64 ,   capacity_msat :  u64 ,  decay_params :  ProbabilisticScoringDecayParameters 
963+ 		& mut  self ,  source :  & NodeId ,  target :  & NodeId ,  capacity_msat :  u64 ,  decay_params :  ProbabilisticScoringDecayParameters 
963964	)  -> DirectedChannelLiquidity < & mut  u64 ,  & mut  HistoricalBucketRangeTracker ,  T ,  & mut  T >  { 
964965		let  ( min_liquidity_offset_msat,  max_liquidity_offset_msat,  min_liquidity_offset_history,  max_liquidity_offset_history)  =
965966			if  source < target { 
@@ -977,7 +978,6 @@ impl<T: Time> ChannelLiquidity<T> {
977978				min_liquidity_offset_history, 
978979				max_liquidity_offset_history, 
979980			} , 
980- 			inflight_htlc_msat, 
981981			capacity_msat, 
982982			last_updated :  & mut  self . last_updated , 
983983			now :  T :: now ( ) , 
@@ -1033,7 +1033,7 @@ impl<L: Deref<Target = u64>, BRT: Deref<Target = HistoricalBucketRangeTracker>,
10331033	/// Returns a liquidity penalty for routing the given HTLC `amount_msat` through the channel in 
10341034/// this direction. 
10351035fn  penalty_msat ( & self ,  amount_msat :  u64 ,  score_params :  & ProbabilisticScoringFeeParameters )  -> u64  { 
1036- 		let  available_capacity = self . available_capacity ( ) ; 
1036+ 		let  available_capacity = self . capacity_msat ; 
10371037		let  max_liquidity_msat = self . max_liquidity_msat ( ) ; 
10381038		let  min_liquidity_msat = core:: cmp:: min ( self . min_liquidity_msat ( ) ,  max_liquidity_msat) ; 
10391039
@@ -1129,16 +1129,10 @@ impl<L: Deref<Target = u64>, BRT: Deref<Target = HistoricalBucketRangeTracker>,
11291129	/// Returns the upper bound of the channel liquidity balance in this direction. 
11301130#[ inline( always) ]  
11311131	fn  max_liquidity_msat ( & self )  -> u64  { 
1132- 		self . available_capacity ( ) 
1132+ 		self . capacity_msat 
11331133			. saturating_sub ( self . decayed_offset_msat ( * self . max_liquidity_offset_msat ) ) 
11341134	} 
11351135
1136- 	/// Returns the capacity minus the in-flight HTLCs in this direction. 
1137- #[ inline( always) ]  
1138- 	fn  available_capacity ( & self )  -> u64  { 
1139- 		self . capacity_msat . saturating_sub ( self . inflight_htlc_msat ) 
1140- 	} 
1141- 
11421136	fn  decayed_offset_msat ( & self ,  offset_msat :  u64 )  -> u64  { 
11431137		let  half_life = self . decay_params . liquidity_offset_half_life . as_secs ( ) ; 
11441138		if  half_life != 0  { 
@@ -1273,13 +1267,12 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreLookUp for Prob
12731267			_ => { } , 
12741268		} 
12751269
1276- 		let  amount_msat = usage. amount_msat ; 
1270+ 		let  amount_msat = usage. amount_msat . saturating_add ( usage . inflight_htlc_msat ) ; 
12771271		let  capacity_msat = usage. effective_capacity . as_msat ( ) ; 
1278- 		let  inflight_htlc_msat = usage. inflight_htlc_msat ; 
12791272		self . channel_liquidities 
12801273			. get ( & short_channel_id) 
12811274			. unwrap_or ( & ChannelLiquidity :: new ( ) ) 
1282- 			. as_directed ( source,  target,  inflight_htlc_msat ,   capacity_msat,  self . decay_params ) 
1275+ 			. as_directed ( source,  target,  capacity_msat,  self . decay_params ) 
12831276			. penalty_msat ( amount_msat,  score_params) 
12841277			. saturating_add ( anti_probing_penalty_msat) 
12851278			. saturating_add ( base_penalty_msat) 
@@ -1309,13 +1302,13 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreUpdate for Prob
13091302					self . channel_liquidities 
13101303						. entry ( hop. short_channel_id ) 
13111304						. or_insert_with ( ChannelLiquidity :: new) 
1312- 						. as_directed_mut ( source,  & target,  0 ,   capacity_msat,  self . decay_params ) 
1305+ 						. as_directed_mut ( source,  & target,  capacity_msat,  self . decay_params ) 
13131306						. failed_at_channel ( amount_msat,  format_args ! ( "SCID {}, towards {:?}" ,  hop. short_channel_id,  target) ,  & self . logger ) ; 
13141307				}  else  { 
13151308					self . channel_liquidities 
13161309						. entry ( hop. short_channel_id ) 
13171310						. or_insert_with ( ChannelLiquidity :: new) 
1318- 						. as_directed_mut ( source,  & target,  0 ,   capacity_msat,  self . decay_params ) 
1311+ 						. as_directed_mut ( source,  & target,  capacity_msat,  self . decay_params ) 
13191312						. failed_downstream ( amount_msat,  format_args ! ( "SCID {}, towards {:?}" ,  hop. short_channel_id,  target) ,  & self . logger ) ; 
13201313				} 
13211314			}  else  { 
@@ -1343,7 +1336,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreUpdate for Prob
13431336				self . channel_liquidities 
13441337					. entry ( hop. short_channel_id ) 
13451338					. or_insert_with ( ChannelLiquidity :: new) 
1346- 					. as_directed_mut ( source,  & target,  0 ,   capacity_msat,  self . decay_params ) 
1339+ 					. as_directed_mut ( source,  & target,  capacity_msat,  self . decay_params ) 
13471340					. successful ( amount_msat,  format_args ! ( "SCID {}, towards {:?}" ,  hop. short_channel_id,  target) ,  & self . logger ) ; 
13481341			}  else  { 
13491342				log_debug ! ( self . logger,  "Not able to learn for channel with SCID {} as we do not have graph info for it (likely a route-hint last-hop)." , 
@@ -2259,52 +2252,52 @@ mod tests {
22592252		// Update minimum liquidity. 
22602253
22612254		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2262- 			. as_directed ( & source,  & target,  0 ,   1_000 ,  decay_params) ; 
2255+ 			. as_directed ( & source,  & target,  1_000 ,  decay_params) ; 
22632256		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  100 ) ; 
22642257		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  300 ) ; 
22652258
22662259		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2267- 			. as_directed ( & target,  & source,  0 ,   1_000 ,  decay_params) ; 
2260+ 			. as_directed ( & target,  & source,  1_000 ,  decay_params) ; 
22682261		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  700 ) ; 
22692262		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  900 ) ; 
22702263
22712264		scorer. channel_liquidities . get_mut ( & 42 ) . unwrap ( ) 
2272- 			. as_directed_mut ( & source,  & target,  0 ,   1_000 ,  decay_params) 
2265+ 			. as_directed_mut ( & source,  & target,  1_000 ,  decay_params) 
22732266			. set_min_liquidity_msat ( 200 ) ; 
22742267
22752268		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2276- 			. as_directed ( & source,  & target,  0 ,   1_000 ,  decay_params) ; 
2269+ 			. as_directed ( & source,  & target,  1_000 ,  decay_params) ; 
22772270		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  200 ) ; 
22782271		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  300 ) ; 
22792272
22802273		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2281- 			. as_directed ( & target,  & source,  0 ,   1_000 ,  decay_params) ; 
2274+ 			. as_directed ( & target,  & source,  1_000 ,  decay_params) ; 
22822275		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  700 ) ; 
22832276		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  800 ) ; 
22842277
22852278		// Update maximum liquidity. 
22862279
22872280		let  liquidity = scorer. channel_liquidities . get ( & 43 ) . unwrap ( ) 
2288- 			. as_directed ( & target,  & recipient,  0 ,   1_000 ,  decay_params) ; 
2281+ 			. as_directed ( & target,  & recipient,  1_000 ,  decay_params) ; 
22892282		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  700 ) ; 
22902283		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  900 ) ; 
22912284
22922285		let  liquidity = scorer. channel_liquidities . get ( & 43 ) . unwrap ( ) 
2293- 			. as_directed ( & recipient,  & target,  0 ,   1_000 ,  decay_params) ; 
2286+ 			. as_directed ( & recipient,  & target,  1_000 ,  decay_params) ; 
22942287		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  100 ) ; 
22952288		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  300 ) ; 
22962289
22972290		scorer. channel_liquidities . get_mut ( & 43 ) . unwrap ( ) 
2298- 			. as_directed_mut ( & target,  & recipient,  0 ,   1_000 ,  decay_params) 
2291+ 			. as_directed_mut ( & target,  & recipient,  1_000 ,  decay_params) 
22992292			. set_max_liquidity_msat ( 200 ) ; 
23002293
23012294		let  liquidity = scorer. channel_liquidities . get ( & 43 ) . unwrap ( ) 
2302- 			. as_directed ( & target,  & recipient,  0 ,   1_000 ,  decay_params) ; 
2295+ 			. as_directed ( & target,  & recipient,  1_000 ,  decay_params) ; 
23032296		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  0 ) ; 
23042297		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  200 ) ; 
23052298
23062299		let  liquidity = scorer. channel_liquidities . get ( & 43 ) . unwrap ( ) 
2307- 			. as_directed ( & recipient,  & target,  0 ,   1_000 ,  decay_params) ; 
2300+ 			. as_directed ( & recipient,  & target,  1_000 ,  decay_params) ; 
23082301		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  800 ) ; 
23092302		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  1000 ) ; 
23102303	} 
@@ -2328,42 +2321,42 @@ mod tests {
23282321
23292322		// Check initial bounds. 
23302323		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2331- 			. as_directed ( & source,  & target,  0 ,   1_000 ,  decay_params) ; 
2324+ 			. as_directed ( & source,  & target,  1_000 ,  decay_params) ; 
23322325		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  400 ) ; 
23332326		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  800 ) ; 
23342327
23352328		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2336- 			. as_directed ( & target,  & source,  0 ,   1_000 ,  decay_params) ; 
2329+ 			. as_directed ( & target,  & source,  1_000 ,  decay_params) ; 
23372330		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  200 ) ; 
23382331		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  600 ) ; 
23392332
23402333		// Reset from source to target. 
23412334		scorer. channel_liquidities . get_mut ( & 42 ) . unwrap ( ) 
2342- 			. as_directed_mut ( & source,  & target,  0 ,   1_000 ,  decay_params) 
2335+ 			. as_directed_mut ( & source,  & target,  1_000 ,  decay_params) 
23432336			. set_min_liquidity_msat ( 900 ) ; 
23442337
23452338		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2346- 			. as_directed ( & source,  & target,  0 ,   1_000 ,  decay_params) ; 
2339+ 			. as_directed ( & source,  & target,  1_000 ,  decay_params) ; 
23472340		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  900 ) ; 
23482341		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  1_000 ) ; 
23492342
23502343		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2351- 			. as_directed ( & target,  & source,  0 ,   1_000 ,  decay_params) ; 
2344+ 			. as_directed ( & target,  & source,  1_000 ,  decay_params) ; 
23522345		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  0 ) ; 
23532346		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  100 ) ; 
23542347
23552348		// Reset from target to source. 
23562349		scorer. channel_liquidities . get_mut ( & 42 ) . unwrap ( ) 
2357- 			. as_directed_mut ( & target,  & source,  0 ,   1_000 ,  decay_params) 
2350+ 			. as_directed_mut ( & target,  & source,  1_000 ,  decay_params) 
23582351			. set_min_liquidity_msat ( 400 ) ; 
23592352
23602353		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2361- 			. as_directed ( & source,  & target,  0 ,   1_000 ,  decay_params) ; 
2354+ 			. as_directed ( & source,  & target,  1_000 ,  decay_params) ; 
23622355		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  0 ) ; 
23632356		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  600 ) ; 
23642357
23652358		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2366- 			. as_directed ( & target,  & source,  0 ,   1_000 ,  decay_params) ; 
2359+ 			. as_directed ( & target,  & source,  1_000 ,  decay_params) ; 
23672360		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  400 ) ; 
23682361		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  1_000 ) ; 
23692362	} 
@@ -2387,42 +2380,42 @@ mod tests {
23872380
23882381		// Check initial bounds. 
23892382		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2390- 			. as_directed ( & source,  & target,  0 ,   1_000 ,  decay_params) ; 
2383+ 			. as_directed ( & source,  & target,  1_000 ,  decay_params) ; 
23912384		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  400 ) ; 
23922385		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  800 ) ; 
23932386
23942387		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2395- 			. as_directed ( & target,  & source,  0 ,   1_000 ,  decay_params) ; 
2388+ 			. as_directed ( & target,  & source,  1_000 ,  decay_params) ; 
23962389		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  200 ) ; 
23972390		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  600 ) ; 
23982391
23992392		// Reset from source to target. 
24002393		scorer. channel_liquidities . get_mut ( & 42 ) . unwrap ( ) 
2401- 			. as_directed_mut ( & source,  & target,  0 ,   1_000 ,  decay_params) 
2394+ 			. as_directed_mut ( & source,  & target,  1_000 ,  decay_params) 
24022395			. set_max_liquidity_msat ( 300 ) ; 
24032396
24042397		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2405- 			. as_directed ( & source,  & target,  0 ,   1_000 ,  decay_params) ; 
2398+ 			. as_directed ( & source,  & target,  1_000 ,  decay_params) ; 
24062399		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  0 ) ; 
24072400		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  300 ) ; 
24082401
24092402		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2410- 			. as_directed ( & target,  & source,  0 ,   1_000 ,  decay_params) ; 
2403+ 			. as_directed ( & target,  & source,  1_000 ,  decay_params) ; 
24112404		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  700 ) ; 
24122405		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  1_000 ) ; 
24132406
24142407		// Reset from target to source. 
24152408		scorer. channel_liquidities . get_mut ( & 42 ) . unwrap ( ) 
2416- 			. as_directed_mut ( & target,  & source,  0 ,   1_000 ,  decay_params) 
2409+ 			. as_directed_mut ( & target,  & source,  1_000 ,  decay_params) 
24172410			. set_max_liquidity_msat ( 600 ) ; 
24182411
24192412		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2420- 			. as_directed ( & source,  & target,  0 ,   1_000 ,  decay_params) ; 
2413+ 			. as_directed ( & source,  & target,  1_000 ,  decay_params) ; 
24212414		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  400 ) ; 
24222415		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  1_000 ) ; 
24232416
24242417		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
2425- 			. as_directed ( & target,  & source,  0 ,   1_000 ,  decay_params) ; 
2418+ 			. as_directed ( & target,  & source,  1_000 ,  decay_params) ; 
24262419		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  0 ) ; 
24272420		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  600 ) ; 
24282421	} 
@@ -3230,7 +3223,7 @@ mod tests {
32303223			effective_capacity :  EffectiveCapacity :: Total  {  capacity_msat :  1_024 ,  htlc_maximum_msat :  1_024  } , 
32313224		} ; 
32323225		scorer. payment_path_failed ( & payment_path_for_amount ( 1 ) ,  42 ) ; 
3233- 		assert_eq ! ( scorer. channel_penalty_msat( 42 ,  & source,  & target,  usage,  & params) ,  2048 ) ; 
3226+ 		assert_eq ! ( scorer. channel_penalty_msat( 42 ,  & source,  & target,  usage,  & params) ,  2050 ) ; 
32343227		usage. inflight_htlc_msat  = 0 ; 
32353228		assert_eq ! ( scorer. channel_penalty_msat( 42 ,  & source,  & target,  usage,  & params) ,  866 ) ; 
32363229
@@ -3344,7 +3337,7 @@ mod tests {
33443337		scorer. payment_path_failed ( & path,  43 ) ; 
33453338
33463339		let  liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( ) 
3347- 			. as_directed ( & source,  & target,  0 ,   1_000 ,  decay_params) ; 
3340+ 			. as_directed ( & source,  & target,  1_000 ,  decay_params) ; 
33483341		assert_eq ! ( liquidity. min_liquidity_msat( ) ,  256 ) ; 
33493342		assert_eq ! ( liquidity. max_liquidity_msat( ) ,  768 ) ; 
33503343	} 
0 commit comments