@@ -789,7 +789,7 @@ struct ChannelLiquidity {
789
789
min_liquidity_offset_history : HistoricalBucketRangeTracker ,
790
790
max_liquidity_offset_history : HistoricalBucketRangeTracker ,
791
791
792
- /// Time when the liquidity bounds were last modified as an offset since the unix epoch.
792
+ /// Time when either liquidity bound was last modified as an offset since the unix epoch.
793
793
last_updated : Duration ,
794
794
795
795
/// Time when the historical liquidity bounds were last modified as an offset against the unix
@@ -805,7 +805,6 @@ struct DirectedChannelLiquidity<L: Deref<Target = u64>, BRT: Deref<Target = Hist
805
805
capacity_msat : u64 ,
806
806
last_updated : T ,
807
807
offset_history_last_updated : T ,
808
- decay_params : ProbabilisticScoringDecayParameters ,
809
808
}
810
809
811
810
impl < G : Deref < Target = NetworkGraph < L > > , L : Deref > ProbabilisticScorer < G , L > where L :: Target : Logger {
@@ -837,7 +836,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ProbabilisticScorer<G, L> whe
837
836
let log_direction = |source, target| {
838
837
if let Some ( ( directed_info, _) ) = chan_debug. as_directed_to ( target) {
839
838
let amt = directed_info. effective_capacity ( ) . as_msat ( ) ;
840
- let dir_liq = liq. as_directed ( source, target, amt, self . decay_params ) ;
839
+ let dir_liq = liq. as_directed ( source, target, amt) ;
841
840
842
841
let min_buckets = & dir_liq. liquidity_history . min_liquidity_offset_history . buckets ;
843
842
let max_buckets = & dir_liq. liquidity_history . max_liquidity_offset_history . buckets ;
@@ -889,7 +888,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ProbabilisticScorer<G, L> whe
889
888
if let Some ( liq) = self . channel_liquidities . get ( & scid) {
890
889
if let Some ( ( directed_info, source) ) = chan. as_directed_to ( target) {
891
890
let amt = directed_info. effective_capacity ( ) . as_msat ( ) ;
892
- let dir_liq = liq. as_directed ( source, target, amt, self . decay_params ) ;
891
+ let dir_liq = liq. as_directed ( source, target, amt) ;
893
892
return Some ( ( dir_liq. min_liquidity_msat ( ) , dir_liq. max_liquidity_msat ( ) ) ) ;
894
893
}
895
894
}
@@ -931,7 +930,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ProbabilisticScorer<G, L> whe
931
930
if let Some ( liq) = self . channel_liquidities . get ( & scid) {
932
931
if let Some ( ( directed_info, source) ) = chan. as_directed_to ( target) {
933
932
let amt = directed_info. effective_capacity ( ) . as_msat ( ) ;
934
- let dir_liq = liq. as_directed ( source, target, amt, self . decay_params ) ;
933
+ let dir_liq = liq. as_directed ( source, target, amt) ;
935
934
936
935
let min_buckets = dir_liq. liquidity_history . min_liquidity_offset_history . buckets ;
937
936
let mut max_buckets = dir_liq. liquidity_history . max_liquidity_offset_history . buckets ;
@@ -962,7 +961,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ProbabilisticScorer<G, L> whe
962
961
if let Some ( liq) = self . channel_liquidities . get ( & scid) {
963
962
if let Some ( ( directed_info, source) ) = chan. as_directed_to ( target) {
964
963
let capacity_msat = directed_info. effective_capacity ( ) . as_msat ( ) ;
965
- let dir_liq = liq. as_directed ( source, target, capacity_msat, self . decay_params ) ;
964
+ let dir_liq = liq. as_directed ( source, target, capacity_msat) ;
966
965
967
966
return dir_liq. liquidity_history . calculate_success_probability_times_billion (
968
967
& params, amount_msat, capacity_msat
@@ -989,7 +988,7 @@ impl ChannelLiquidity {
989
988
/// Returns a view of the channel liquidity directed from `source` to `target` assuming
990
989
/// `capacity_msat`.
991
990
fn as_directed (
992
- & self , source : & NodeId , target : & NodeId , capacity_msat : u64 , decay_params : ProbabilisticScoringDecayParameters
991
+ & self , source : & NodeId , target : & NodeId , capacity_msat : u64 ,
993
992
) -> DirectedChannelLiquidity < & u64 , & HistoricalBucketRangeTracker , & Duration > {
994
993
let ( min_liquidity_offset_msat, max_liquidity_offset_msat, min_liquidity_offset_history, max_liquidity_offset_history) =
995
994
if source < target {
@@ -1010,14 +1009,13 @@ impl ChannelLiquidity {
1010
1009
capacity_msat,
1011
1010
last_updated : & self . last_updated ,
1012
1011
offset_history_last_updated : & self . offset_history_last_updated ,
1013
- decay_params : decay_params,
1014
1012
}
1015
1013
}
1016
1014
1017
1015
/// Returns a mutable view of the channel liquidity directed from `source` to `target` assuming
1018
1016
/// `capacity_msat`.
1019
1017
fn as_directed_mut (
1020
- & mut self , source : & NodeId , target : & NodeId , capacity_msat : u64 , decay_params : ProbabilisticScoringDecayParameters
1018
+ & mut self , source : & NodeId , target : & NodeId , capacity_msat : u64 ,
1021
1019
) -> DirectedChannelLiquidity < & mut u64 , & mut HistoricalBucketRangeTracker , & mut Duration > {
1022
1020
let ( min_liquidity_offset_msat, max_liquidity_offset_msat, min_liquidity_offset_history, max_liquidity_offset_history) =
1023
1021
if source < target {
@@ -1038,7 +1036,6 @@ impl ChannelLiquidity {
1038
1036
capacity_msat,
1039
1037
last_updated : & mut self . last_updated ,
1040
1038
offset_history_last_updated : & mut self . offset_history_last_updated ,
1041
- decay_params : decay_params,
1042
1039
}
1043
1040
}
1044
1041
@@ -1289,14 +1286,6 @@ DirectedChannelLiquidity<L, BRT, T> {
1289
1286
/// state"), we allow the caller to set an offset applied to our liquidity bounds which
1290
1287
/// represents the amount of the successful payment we just made.
1291
1288
fn update_history_buckets ( & mut self , bucket_offset_msat : u64 , duration_since_epoch : Duration ) {
1292
- let half_lives =
1293
- duration_since_epoch. checked_sub ( * self . offset_history_last_updated )
1294
- . unwrap_or ( Duration :: ZERO ) . as_secs ( )
1295
- . checked_div ( self . decay_params . historical_no_updates_half_life . as_secs ( ) )
1296
- . map ( |v| v. try_into ( ) . unwrap_or ( u32:: max_value ( ) ) ) . unwrap_or ( u32:: max_value ( ) ) ;
1297
- self . liquidity_history . min_liquidity_offset_history . time_decay_data ( half_lives) ;
1298
- self . liquidity_history . max_liquidity_offset_history . time_decay_data ( half_lives) ;
1299
-
1300
1289
self . liquidity_history . min_liquidity_offset_history . track_datapoint (
1301
1290
* self . min_liquidity_offset_msat + bucket_offset_msat, self . capacity_msat
1302
1291
) ;
@@ -1369,7 +1358,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreLookUp for Probabilistic
1369
1358
self . channel_liquidities
1370
1359
. get ( & scid)
1371
1360
. unwrap_or ( & ChannelLiquidity :: new ( Duration :: ZERO ) )
1372
- . as_directed ( & source, & target, capacity_msat, self . decay_params )
1361
+ . as_directed ( & source, & target, capacity_msat)
1373
1362
. penalty_msat ( amount_msat, score_params)
1374
1363
. saturating_add ( anti_probing_penalty_msat)
1375
1364
. saturating_add ( base_penalty_msat)
@@ -1399,14 +1388,14 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreUpdate for Probabilistic
1399
1388
self . channel_liquidities
1400
1389
. entry ( hop. short_channel_id )
1401
1390
. or_insert_with ( || ChannelLiquidity :: new ( duration_since_epoch) )
1402
- . as_directed_mut ( source, & target, capacity_msat, self . decay_params )
1391
+ . as_directed_mut ( source, & target, capacity_msat)
1403
1392
. failed_at_channel ( amount_msat, duration_since_epoch,
1404
1393
format_args ! ( "SCID {}, towards {:?}" , hop. short_channel_id, target) , & self . logger ) ;
1405
1394
} else {
1406
1395
self . channel_liquidities
1407
1396
. entry ( hop. short_channel_id )
1408
1397
. or_insert_with ( || ChannelLiquidity :: new ( duration_since_epoch) )
1409
- . as_directed_mut ( source, & target, capacity_msat, self . decay_params )
1398
+ . as_directed_mut ( source, & target, capacity_msat)
1410
1399
. failed_downstream ( amount_msat, duration_since_epoch,
1411
1400
format_args ! ( "SCID {}, towards {:?}" , hop. short_channel_id, target) , & self . logger ) ;
1412
1401
}
@@ -1435,7 +1424,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreUpdate for Probabilistic
1435
1424
self . channel_liquidities
1436
1425
. entry ( hop. short_channel_id )
1437
1426
. or_insert_with ( || ChannelLiquidity :: new ( duration_since_epoch) )
1438
- . as_directed_mut ( source, & target, capacity_msat, self . decay_params )
1427
+ . as_directed_mut ( source, & target, capacity_msat)
1439
1428
. successful ( amount_msat, duration_since_epoch,
1440
1429
format_args ! ( "SCID {}, towards {:?}" , hop. short_channel_id, target) , & self . logger ) ;
1441
1430
} else {
@@ -1959,14 +1948,6 @@ mod bucketed_history {
1959
1948
self . buckets [ bucket] = self . buckets [ bucket] . saturating_add ( BUCKET_FIXED_POINT_ONE ) ;
1960
1949
}
1961
1950
}
1962
- /// Decay all buckets by the given number of half-lives. Used to more aggressively remove old
1963
- /// datapoints as we receive newer information.
1964
- #[ inline]
1965
- pub ( super ) fn time_decay_data ( & mut self , half_lives : u32 ) {
1966
- for e in self . buckets . iter_mut ( ) {
1967
- * e = e. checked_shr ( half_lives) . unwrap_or ( 0 ) ;
1968
- }
1969
- }
1970
1951
}
1971
1952
1972
1953
impl_writeable_tlv_based ! ( HistoricalBucketRangeTracker , { ( 0 , buckets, required) } ) ;
@@ -2359,52 +2340,52 @@ mod tests {
2359
2340
// Update minimum liquidity.
2360
2341
2361
2342
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2362
- . as_directed ( & source, & target, 1_000 , decay_params ) ;
2343
+ . as_directed ( & source, & target, 1_000 ) ;
2363
2344
assert_eq ! ( liquidity. min_liquidity_msat( ) , 100 ) ;
2364
2345
assert_eq ! ( liquidity. max_liquidity_msat( ) , 300 ) ;
2365
2346
2366
2347
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2367
- . as_directed ( & target, & source, 1_000 , decay_params ) ;
2348
+ . as_directed ( & target, & source, 1_000 ) ;
2368
2349
assert_eq ! ( liquidity. min_liquidity_msat( ) , 700 ) ;
2369
2350
assert_eq ! ( liquidity. max_liquidity_msat( ) , 900 ) ;
2370
2351
2371
2352
scorer. channel_liquidities . get_mut ( & 42 ) . unwrap ( )
2372
- . as_directed_mut ( & source, & target, 1_000 , decay_params )
2353
+ . as_directed_mut ( & source, & target, 1_000 )
2373
2354
. set_min_liquidity_msat ( 200 , Duration :: ZERO ) ;
2374
2355
2375
2356
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2376
- . as_directed ( & source, & target, 1_000 , decay_params ) ;
2357
+ . as_directed ( & source, & target, 1_000 ) ;
2377
2358
assert_eq ! ( liquidity. min_liquidity_msat( ) , 200 ) ;
2378
2359
assert_eq ! ( liquidity. max_liquidity_msat( ) , 300 ) ;
2379
2360
2380
2361
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2381
- . as_directed ( & target, & source, 1_000 , decay_params ) ;
2362
+ . as_directed ( & target, & source, 1_000 ) ;
2382
2363
assert_eq ! ( liquidity. min_liquidity_msat( ) , 700 ) ;
2383
2364
assert_eq ! ( liquidity. max_liquidity_msat( ) , 800 ) ;
2384
2365
2385
2366
// Update maximum liquidity.
2386
2367
2387
2368
let liquidity = scorer. channel_liquidities . get ( & 43 ) . unwrap ( )
2388
- . as_directed ( & target, & recipient, 1_000 , decay_params ) ;
2369
+ . as_directed ( & target, & recipient, 1_000 ) ;
2389
2370
assert_eq ! ( liquidity. min_liquidity_msat( ) , 700 ) ;
2390
2371
assert_eq ! ( liquidity. max_liquidity_msat( ) , 900 ) ;
2391
2372
2392
2373
let liquidity = scorer. channel_liquidities . get ( & 43 ) . unwrap ( )
2393
- . as_directed ( & recipient, & target, 1_000 , decay_params ) ;
2374
+ . as_directed ( & recipient, & target, 1_000 ) ;
2394
2375
assert_eq ! ( liquidity. min_liquidity_msat( ) , 100 ) ;
2395
2376
assert_eq ! ( liquidity. max_liquidity_msat( ) , 300 ) ;
2396
2377
2397
2378
scorer. channel_liquidities . get_mut ( & 43 ) . unwrap ( )
2398
- . as_directed_mut ( & target, & recipient, 1_000 , decay_params )
2379
+ . as_directed_mut ( & target, & recipient, 1_000 )
2399
2380
. set_max_liquidity_msat ( 200 , Duration :: ZERO ) ;
2400
2381
2401
2382
let liquidity = scorer. channel_liquidities . get ( & 43 ) . unwrap ( )
2402
- . as_directed ( & target, & recipient, 1_000 , decay_params ) ;
2383
+ . as_directed ( & target, & recipient, 1_000 ) ;
2403
2384
assert_eq ! ( liquidity. min_liquidity_msat( ) , 0 ) ;
2404
2385
assert_eq ! ( liquidity. max_liquidity_msat( ) , 200 ) ;
2405
2386
2406
2387
let liquidity = scorer. channel_liquidities . get ( & 43 ) . unwrap ( )
2407
- . as_directed ( & recipient, & target, 1_000 , decay_params ) ;
2388
+ . as_directed ( & recipient, & target, 1_000 ) ;
2408
2389
assert_eq ! ( liquidity. min_liquidity_msat( ) , 800 ) ;
2409
2390
assert_eq ! ( liquidity. max_liquidity_msat( ) , 1000 ) ;
2410
2391
}
@@ -2430,42 +2411,42 @@ mod tests {
2430
2411
2431
2412
// Check initial bounds.
2432
2413
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2433
- . as_directed ( & source, & target, 1_000 , decay_params ) ;
2414
+ . as_directed ( & source, & target, 1_000 ) ;
2434
2415
assert_eq ! ( liquidity. min_liquidity_msat( ) , 400 ) ;
2435
2416
assert_eq ! ( liquidity. max_liquidity_msat( ) , 800 ) ;
2436
2417
2437
2418
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2438
- . as_directed ( & target, & source, 1_000 , decay_params ) ;
2419
+ . as_directed ( & target, & source, 1_000 ) ;
2439
2420
assert_eq ! ( liquidity. min_liquidity_msat( ) , 200 ) ;
2440
2421
assert_eq ! ( liquidity. max_liquidity_msat( ) , 600 ) ;
2441
2422
2442
2423
// Reset from source to target.
2443
2424
scorer. channel_liquidities . get_mut ( & 42 ) . unwrap ( )
2444
- . as_directed_mut ( & source, & target, 1_000 , decay_params )
2425
+ . as_directed_mut ( & source, & target, 1_000 )
2445
2426
. set_min_liquidity_msat ( 900 , Duration :: ZERO ) ;
2446
2427
2447
2428
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2448
- . as_directed ( & source, & target, 1_000 , decay_params ) ;
2429
+ . as_directed ( & source, & target, 1_000 ) ;
2449
2430
assert_eq ! ( liquidity. min_liquidity_msat( ) , 900 ) ;
2450
2431
assert_eq ! ( liquidity. max_liquidity_msat( ) , 1_000 ) ;
2451
2432
2452
2433
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2453
- . as_directed ( & target, & source, 1_000 , decay_params ) ;
2434
+ . as_directed ( & target, & source, 1_000 ) ;
2454
2435
assert_eq ! ( liquidity. min_liquidity_msat( ) , 0 ) ;
2455
2436
assert_eq ! ( liquidity. max_liquidity_msat( ) , 100 ) ;
2456
2437
2457
2438
// Reset from target to source.
2458
2439
scorer. channel_liquidities . get_mut ( & 42 ) . unwrap ( )
2459
- . as_directed_mut ( & target, & source, 1_000 , decay_params )
2440
+ . as_directed_mut ( & target, & source, 1_000 )
2460
2441
. set_min_liquidity_msat ( 400 , Duration :: ZERO ) ;
2461
2442
2462
2443
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2463
- . as_directed ( & source, & target, 1_000 , decay_params ) ;
2444
+ . as_directed ( & source, & target, 1_000 ) ;
2464
2445
assert_eq ! ( liquidity. min_liquidity_msat( ) , 0 ) ;
2465
2446
assert_eq ! ( liquidity. max_liquidity_msat( ) , 600 ) ;
2466
2447
2467
2448
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2468
- . as_directed ( & target, & source, 1_000 , decay_params ) ;
2449
+ . as_directed ( & target, & source, 1_000 ) ;
2469
2450
assert_eq ! ( liquidity. min_liquidity_msat( ) , 400 ) ;
2470
2451
assert_eq ! ( liquidity. max_liquidity_msat( ) , 1_000 ) ;
2471
2452
}
@@ -2491,42 +2472,42 @@ mod tests {
2491
2472
2492
2473
// Check initial bounds.
2493
2474
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2494
- . as_directed ( & source, & target, 1_000 , decay_params ) ;
2475
+ . as_directed ( & source, & target, 1_000 ) ;
2495
2476
assert_eq ! ( liquidity. min_liquidity_msat( ) , 400 ) ;
2496
2477
assert_eq ! ( liquidity. max_liquidity_msat( ) , 800 ) ;
2497
2478
2498
2479
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2499
- . as_directed ( & target, & source, 1_000 , decay_params ) ;
2480
+ . as_directed ( & target, & source, 1_000 ) ;
2500
2481
assert_eq ! ( liquidity. min_liquidity_msat( ) , 200 ) ;
2501
2482
assert_eq ! ( liquidity. max_liquidity_msat( ) , 600 ) ;
2502
2483
2503
2484
// Reset from source to target.
2504
2485
scorer. channel_liquidities . get_mut ( & 42 ) . unwrap ( )
2505
- . as_directed_mut ( & source, & target, 1_000 , decay_params )
2486
+ . as_directed_mut ( & source, & target, 1_000 )
2506
2487
. set_max_liquidity_msat ( 300 , Duration :: ZERO ) ;
2507
2488
2508
2489
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2509
- . as_directed ( & source, & target, 1_000 , decay_params ) ;
2490
+ . as_directed ( & source, & target, 1_000 ) ;
2510
2491
assert_eq ! ( liquidity. min_liquidity_msat( ) , 0 ) ;
2511
2492
assert_eq ! ( liquidity. max_liquidity_msat( ) , 300 ) ;
2512
2493
2513
2494
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2514
- . as_directed ( & target, & source, 1_000 , decay_params ) ;
2495
+ . as_directed ( & target, & source, 1_000 ) ;
2515
2496
assert_eq ! ( liquidity. min_liquidity_msat( ) , 700 ) ;
2516
2497
assert_eq ! ( liquidity. max_liquidity_msat( ) , 1_000 ) ;
2517
2498
2518
2499
// Reset from target to source.
2519
2500
scorer. channel_liquidities . get_mut ( & 42 ) . unwrap ( )
2520
- . as_directed_mut ( & target, & source, 1_000 , decay_params )
2501
+ . as_directed_mut ( & target, & source, 1_000 )
2521
2502
. set_max_liquidity_msat ( 600 , Duration :: ZERO ) ;
2522
2503
2523
2504
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2524
- . as_directed ( & source, & target, 1_000 , decay_params ) ;
2505
+ . as_directed ( & source, & target, 1_000 ) ;
2525
2506
assert_eq ! ( liquidity. min_liquidity_msat( ) , 400 ) ;
2526
2507
assert_eq ! ( liquidity. max_liquidity_msat( ) , 1_000 ) ;
2527
2508
2528
2509
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
2529
- . as_directed ( & target, & source, 1_000 , decay_params ) ;
2510
+ . as_directed ( & target, & source, 1_000 ) ;
2530
2511
assert_eq ! ( liquidity. min_liquidity_msat( ) , 0 ) ;
2531
2512
assert_eq ! ( liquidity. max_liquidity_msat( ) , 600 ) ;
2532
2513
}
@@ -2971,47 +2952,6 @@ mod tests {
2971
2952
assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , u64 :: max_value( ) ) ;
2972
2953
}
2973
2954
2974
- #[ test]
2975
- fn decays_liquidity_bounds_without_shift_overflow ( ) {
2976
- let logger = TestLogger :: new ( ) ;
2977
- let network_graph = network_graph ( & logger) ;
2978
- let params = ProbabilisticScoringFeeParameters {
2979
- liquidity_penalty_multiplier_msat : 1_000 ,
2980
- ..ProbabilisticScoringFeeParameters :: zero_penalty ( )
2981
- } ;
2982
- let decay_params = ProbabilisticScoringDecayParameters {
2983
- liquidity_offset_half_life : Duration :: from_secs ( 10 ) ,
2984
- ..ProbabilisticScoringDecayParameters :: default ( )
2985
- } ;
2986
- let mut scorer = ProbabilisticScorer :: new ( decay_params, & network_graph, & logger) ;
2987
- let source = source_node_id ( ) ;
2988
- let usage = ChannelUsage {
2989
- amount_msat : 256 ,
2990
- inflight_htlc_msat : 0 ,
2991
- effective_capacity : EffectiveCapacity :: Total { capacity_msat : 1_024 , htlc_maximum_msat : 1_000 } ,
2992
- } ;
2993
- let channel = network_graph. read_only ( ) . channel ( 42 ) . unwrap ( ) . to_owned ( ) ;
2994
- let ( info, _) = channel. as_directed_from ( & source) . unwrap ( ) ;
2995
- let candidate = CandidateRouteHop :: PublicHop {
2996
- info,
2997
- short_channel_id : 42 ,
2998
- } ;
2999
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 125 ) ;
3000
-
3001
- scorer. payment_path_failed ( & payment_path_for_amount ( 512 ) , 42 , Duration :: ZERO ) ;
3002
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 281 ) ;
3003
-
3004
- // An unchecked right shift 64 bits or more in DirectedChannelLiquidity::decayed_offset_msat
3005
- // would cause an overflow.
3006
- SinceEpoch :: advance ( Duration :: from_secs ( 10 * 64 ) ) ;
3007
- scorer. time_passed ( Duration :: from_secs ( 10 * 64 ) ) ;
3008
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 125 ) ;
3009
-
3010
- SinceEpoch :: advance ( Duration :: from_secs ( 10 ) ) ;
3011
- scorer. time_passed ( Duration :: from_secs ( 10 * 65 ) ) ;
3012
- assert_eq ! ( scorer. channel_penalty_msat( & candidate, usage, & params) , 125 ) ;
3013
- }
3014
-
3015
2955
#[ test]
3016
2956
fn restricts_liquidity_bounds_after_decay ( ) {
3017
2957
let logger = TestLogger :: new ( ) ;
@@ -3660,7 +3600,7 @@ mod tests {
3660
3600
scorer. payment_path_failed ( & path, 43 , Duration :: ZERO ) ;
3661
3601
3662
3602
let liquidity = scorer. channel_liquidities . get ( & 42 ) . unwrap ( )
3663
- . as_directed ( & source, & target, 1_000 , decay_params ) ;
3603
+ . as_directed ( & source, & target, 1_000 ) ;
3664
3604
assert_eq ! ( liquidity. min_liquidity_msat( ) , 256 ) ;
3665
3605
assert_eq ! ( liquidity. max_liquidity_msat( ) , 768 ) ;
3666
3606
}
0 commit comments