@@ -2952,47 +2952,6 @@ mod tests {
2952
2952
assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , u64 :: max_value( ) ) ;
2953
2953
}
2954
2954
2955
- #[ test]
2956
- fn decays_liquidity_bounds_without_shift_overflow ( ) {
2957
- let logger = TestLogger :: new ( ) ;
2958
- let network_graph = network_graph ( & logger) ;
2959
- let params = ProbabilisticScoringFeeParameters {
2960
- liquidity_penalty_multiplier_msat : 1_000 ,
2961
- ..ProbabilisticScoringFeeParameters :: zero_penalty ( )
2962
- } ;
2963
- let decay_params = ProbabilisticScoringDecayParameters {
2964
- liquidity_offset_half_life : Duration :: from_secs ( 10 ) ,
2965
- ..ProbabilisticScoringDecayParameters :: default ( )
2966
- } ;
2967
- let mut scorer = ProbabilisticScorer :: new ( decay_params, & network_graph, & logger) ;
2968
- let source = source_node_id ( ) ;
2969
- let usage = ChannelUsage {
2970
- amount_msat : 256 ,
2971
- inflight_htlc_msat : 0 ,
2972
- effective_capacity : EffectiveCapacity :: Total { capacity_msat : 1_024 , htlc_maximum_msat : 1_000 } ,
2973
- } ;
2974
- let channel = network_graph. read_only ( ) . channel ( 42 ) . unwrap ( ) . to_owned ( ) ;
2975
- let ( info, _) = channel. as_directed_from ( & source) . unwrap ( ) ;
2976
- let candidate = CandidateRouteHop :: PublicHop {
2977
- info,
2978
- short_channel_id : 42 ,
2979
- } ;
2980
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 125 ) ;
2981
-
2982
- scorer. payment_path_failed ( & payment_path_for_amount ( 512 ) , 42 , Duration :: ZERO ) ;
2983
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 281 ) ;
2984
-
2985
- // An unchecked right shift 64 bits or more in DirectedChannelLiquidity::decayed_offset_msat
2986
- // would cause an overflow.
2987
- SinceEpoch :: advance ( Duration :: from_secs ( 10 * 64 ) ) ;
2988
- scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 * 64 ) ) ;
2989
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 125 ) ;
2990
-
2991
- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
2992
- scorer. decay_liquidity_certainty ( Duration :: from_secs ( 10 * 65 ) ) ;
2993
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 125 ) ;
2994
- }
2995
-
2996
2955
#[ test]
2997
2956
fn restricts_liquidity_bounds_after_decay ( ) {
2998
2957
let logger = TestLogger :: new ( ) ;
0 commit comments