@@ -2151,7 +2151,6 @@ mod tests {
21512151 use super :: { ChannelLiquidity , HistoricalBucketRangeTracker , ProbabilisticScoringFeeParameters , ProbabilisticScoringDecayParameters , ProbabilisticScorer } ;
21522152 use crate :: blinded_path:: { BlindedHop , BlindedPath } ;
21532153 use crate :: util:: config:: UserConfig ;
2154- use crate :: util:: time:: tests:: SinceEpoch ;
21552154
21562155 use crate :: ln:: channelmanager;
21572156 use crate :: ln:: msgs:: { ChannelAnnouncement , ChannelUpdate , UnsignedChannelAnnouncement , UnsignedChannelUpdate } ;
@@ -2901,7 +2900,6 @@ mod tests {
29012900 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , u64 :: max_value( ) ) ;
29022901
29032902 // Half decay (i.e., three-quarter life)
2904- SinceEpoch :: advance ( Duration :: from_secs ( 5 ) ) ;
29052903 scorer. time_passed ( Duration :: from_secs ( 5 ) ) ;
29062904 let usage = ChannelUsage { amount_msat : 128 , ..usage } ;
29072905 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 22 ) ;
@@ -2913,7 +2911,6 @@ mod tests {
29132911 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , u64 :: max_value( ) ) ;
29142912
29152913 // One decay (i.e., half life)
2916- SinceEpoch :: advance ( Duration :: from_secs ( 5 ) ) ;
29172914 scorer. time_passed ( Duration :: from_secs ( 10 ) ) ;
29182915 let usage = ChannelUsage { amount_msat : 64 , ..usage } ;
29192916 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 0 ) ;
@@ -2925,7 +2922,6 @@ mod tests {
29252922 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , u64 :: max_value( ) ) ;
29262923
29272924 // Fully decay liquidity lower bound.
2928- SinceEpoch :: advance ( Duration :: from_secs ( 10 * 7 ) ) ;
29292925 scorer. time_passed ( Duration :: from_secs ( 10 * 8 ) ) ;
29302926 let usage = ChannelUsage { amount_msat : 0 , ..usage } ;
29312927 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 0 ) ;
@@ -2937,14 +2933,12 @@ mod tests {
29372933 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , u64 :: max_value( ) ) ;
29382934
29392935 // Fully decay liquidity upper bound.
2940- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
29412936 scorer. time_passed ( Duration :: from_secs ( 10 * 9 ) ) ;
29422937 let usage = ChannelUsage { amount_msat : 0 , ..usage } ;
29432938 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 0 ) ;
29442939 let usage = ChannelUsage { amount_msat : 1_024 , ..usage } ;
29452940 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , u64 :: max_value( ) ) ;
29462941
2947- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
29482942 scorer. time_passed ( Duration :: from_secs ( 10 * 10 ) ) ;
29492943 let usage = ChannelUsage { amount_msat : 0 , ..usage } ;
29502944 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 0 ) ;
@@ -2986,7 +2980,6 @@ mod tests {
29862980 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 281 ) ;
29872981
29882982 // Decaying knowledge gives less confidence (128, 896), meaning a higher penalty.
2989- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
29902983 scorer. time_passed ( Duration :: from_secs ( 10 ) ) ;
29912984 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 291 ) ;
29922985
@@ -3001,7 +2994,6 @@ mod tests {
30012994 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 245 ) ;
30022995
30032996 // Further decaying affects the lower bound more than the upper bound (128, 928).
3004- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
30052997 scorer. time_passed ( Duration :: from_secs ( 20 ) ) ;
30062998 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 280 ) ;
30072999 }
@@ -3036,7 +3028,6 @@ mod tests {
30363028 } ;
30373029 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , u64 :: max_value( ) ) ;
30383030
3039- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
30403031 scorer. time_passed ( Duration :: from_secs ( 10 ) ) ;
30413032 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 473 ) ;
30423033
@@ -3082,7 +3073,6 @@ mod tests {
30823073 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , u64 :: max_value( ) ) ;
30833074
30843075 if decay_before_reload {
3085- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
30863076 scorer. time_passed ( Duration :: from_secs ( 10 ) ) ;
30873077 }
30883078
@@ -3093,7 +3083,6 @@ mod tests {
30933083 let mut deserialized_scorer =
30943084 <ProbabilisticScorer < _ , _ > >:: read ( & mut serialized_scorer, ( decay_params, & network_graph, & logger) ) . unwrap ( ) ;
30953085 if !decay_before_reload {
3096- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
30973086 scorer. time_passed ( Duration :: from_secs ( 10 ) ) ;
30983087 deserialized_scorer. time_passed ( Duration :: from_secs ( 10 ) ) ;
30993088 }
@@ -3102,7 +3091,6 @@ mod tests {
31023091 scorer. payment_path_failed ( & payment_path_for_amount ( 250 ) , 43 , Duration :: from_secs ( 10 ) ) ;
31033092 assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 300 ) ;
31043093
3105- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
31063094 deserialized_scorer. time_passed ( Duration :: from_secs ( 20 ) ) ;
31073095 assert_eq ! ( deserialized_scorer. channel_penalty_msat( & candidate, usage, & params) , 370 ) ;
31083096 }
@@ -3436,7 +3424,6 @@ mod tests {
34363424
34373425 // Advance the time forward 16 half-lives (which the docs claim will ensure all data is
34383426 // gone), and check that we're back to where we started.
3439- SinceEpoch :: advance ( Duration :: from_secs ( 10 * 16 ) ) ;
34403427 scorer. time_passed ( Duration :: from_secs ( 10 * 16 ) ) ;
34413428 {
34423429 let network_graph = network_graph. read_only ( ) ;
@@ -3481,7 +3468,6 @@ mod tests {
34813468 }
34823469
34833470 // Advance to decay all liquidity offsets to zero.
3484- SinceEpoch :: advance ( Duration :: from_secs ( 60 * 60 * 10 ) ) ;
34853471 scorer. time_passed ( Duration :: from_secs ( 10 * ( 16 + 60 * 60 ) ) ) ;
34863472
34873473 // Once even the bounds have decayed information about the channel should be removed
@@ -3734,10 +3720,10 @@ pub mod benches {
37343720 }
37353721 let mut cur_time = Duration :: ZERO ;
37363722 cur_time += Duration :: from_millis ( 1 ) ;
3737- scorer. decay_liquidity_certainty ( cur_time) ;
3723+ scorer. time_passed ( cur_time) ;
37383724 bench. bench_function ( "decay_100k_channel_bounds" , |b| b. iter ( || {
37393725 cur_time += Duration :: from_millis ( 1 ) ;
3740- scorer. decay_liquidity_certainty ( cur_time) ;
3726+ scorer. time_passed ( cur_time) ;
37413727 } ) ) ;
37423728 }
37433729}
0 commit comments