@@ -2145,7 +2145,6 @@ mod tests {
2145
2145
use super :: { ChannelLiquidity , HistoricalBucketRangeTracker , ProbabilisticScoringFeeParameters , ProbabilisticScoringDecayParameters , ProbabilisticScorer } ;
2146
2146
use crate :: blinded_path:: { BlindedHop , BlindedPath } ;
2147
2147
use crate :: util:: config:: UserConfig ;
2148
- use crate :: util:: time:: tests:: SinceEpoch ;
2149
2148
2150
2149
use crate :: ln:: channelmanager;
2151
2150
use crate :: ln:: msgs:: { ChannelAnnouncement , ChannelUpdate , UnsignedChannelAnnouncement , UnsignedChannelUpdate } ;
@@ -2819,7 +2818,6 @@ mod tests {
2819
2818
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , u64 :: max_value( ) ) ;
2820
2819
2821
2820
// Half decay (i.e., three-quarter life)
2822
- SinceEpoch :: advance ( Duration :: from_secs ( 5 ) ) ;
2823
2821
scorer. decay_liquidity_certainty ( Duration :: from_secs ( 5 ) ) ;
2824
2822
let usage = ChannelUsage { amount_msat : 128 , ..usage } ;
2825
2823
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 22 ) ;
@@ -2831,7 +2829,6 @@ mod tests {
2831
2829
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , u64 :: max_value( ) ) ;
2832
2830
2833
2831
// One decay (i.e., half life)
2834
- SinceEpoch :: advance ( Duration :: from_secs ( 5 ) ) ;
2835
2832
scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 ) ) ;
2836
2833
let usage = ChannelUsage { amount_msat : 64 , ..usage } ;
2837
2834
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 0 ) ;
@@ -2843,7 +2840,6 @@ mod tests {
2843
2840
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , u64 :: max_value( ) ) ;
2844
2841
2845
2842
// Fully decay liquidity lower bound.
2846
- SinceEpoch :: advance ( Duration :: from_secs ( 10 * 7 ) ) ;
2847
2843
scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 * 8 ) ) ;
2848
2844
let usage = ChannelUsage { amount_msat : 0 , ..usage } ;
2849
2845
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 0 ) ;
@@ -2855,14 +2851,12 @@ mod tests {
2855
2851
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , u64 :: max_value( ) ) ;
2856
2852
2857
2853
// Fully decay liquidity upper bound.
2858
- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
2859
2854
scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 * 9 ) ) ;
2860
2855
let usage = ChannelUsage { amount_msat : 0 , ..usage } ;
2861
2856
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 0 ) ;
2862
2857
let usage = ChannelUsage { amount_msat : 1_024 , ..usage } ;
2863
2858
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , u64 :: max_value( ) ) ;
2864
2859
2865
- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
2866
2860
scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 * 10 ) ) ;
2867
2861
let usage = ChannelUsage { amount_msat : 0 , ..usage } ;
2868
2862
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 0 ) ;
@@ -2899,7 +2893,6 @@ mod tests {
2899
2893
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 281 ) ;
2900
2894
2901
2895
// Decaying knowledge gives less confidence (128, 896), meaning a higher penalty.
2902
- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
2903
2896
scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 ) ) ;
2904
2897
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 291 ) ;
2905
2898
@@ -2914,7 +2907,6 @@ mod tests {
2914
2907
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 245 ) ;
2915
2908
2916
2909
// Further decaying affects the lower bound more than the upper bound (128, 928).
2917
- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
2918
2910
scorer. decay_liquidity_certainty ( Duration :: from_secs ( 20 ) ) ;
2919
2911
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 280 ) ;
2920
2912
}
@@ -2944,7 +2936,6 @@ mod tests {
2944
2936
scorer. payment_path_failed ( & payment_path_for_amount ( 500 ) , 42 , Duration :: ZERO ) ;
2945
2937
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , u64 :: max_value( ) ) ;
2946
2938
2947
- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
2948
2939
scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 ) ) ;
2949
2940
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 473 ) ;
2950
2941
@@ -2985,7 +2976,6 @@ mod tests {
2985
2976
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , u64 :: max_value( ) ) ;
2986
2977
2987
2978
if decay_before_reload {
2988
- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
2989
2979
scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 ) ) ;
2990
2980
}
2991
2981
@@ -2996,7 +2986,6 @@ mod tests {
2996
2986
let mut deserialized_scorer =
2997
2987
<ProbabilisticScorer < _ , _ > >:: read ( & mut serialized_scorer, ( decay_params, & network_graph, & logger) ) . unwrap ( ) ;
2998
2988
if !decay_before_reload {
2999
- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
3000
2989
scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 ) ) ;
3001
2990
deserialized_scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 ) ) ;
3002
2991
}
@@ -3005,7 +2994,6 @@ mod tests {
3005
2994
scorer. payment_path_failed ( & payment_path_for_amount ( 250 ) , 43 , Duration :: from_secs ( 10 ) ) ;
3006
2995
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 300 ) ;
3007
2996
3008
- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
3009
2997
deserialized_scorer. decay_liquidity_certainty ( Duration :: from_secs ( 20 ) ) ;
3010
2998
assert_eq ! ( deserialized_scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 370 ) ;
3011
2999
}
@@ -3278,7 +3266,6 @@ mod tests {
3278
3266
3279
3267
// Advance the time forward 16 half-lives (which the docs claim will ensure all data is
3280
3268
// gone), and check that we're back to where we started.
3281
- SinceEpoch :: advance ( Duration :: from_secs ( 10 * 16 ) ) ;
3282
3269
scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 * 16 ) ) ;
3283
3270
assert_eq ! ( scorer. channel_penalty_msat( 42 , & source, & target, usage, & params) , 168 ) ;
3284
3271
// Once fully decayed we still have data, so we get 0s for the buckets.
@@ -3304,7 +3291,6 @@ mod tests {
3304
3291
assert_eq ! ( scorer. channel_penalty_msat( 42 , & target, & source, usage, & params) , 2048 ) ;
3305
3292
3306
3293
// Advance to decay all liquidity offsets to zero.
3307
- SinceEpoch :: advance ( Duration :: from_secs ( 60 * 60 * 10 ) ) ;
3308
3294
scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 * ( 16 + 60 * 60 ) ) ) ;
3309
3295
3310
3296
// Once even the bounds have decayed information about the channel should be removed
0 commit comments