@@ -493,7 +493,8 @@ where L::Target: Logger {
493
493
decay_params : ProbabilisticScoringDecayParameters ,
494
494
network_graph : G ,
495
495
logger : L ,
496
- channel_liquidities : HashMap < u64 , ChannelLiquidity < T > > ,
496
+ channel_liquidities : HashMap < u64 , ChannelLiquidity > ,
497
+ _unused_time : core:: marker:: PhantomData < T > ,
497
498
}
498
499
499
500
/// Parameters for configuring [`ProbabilisticScorer`].
@@ -797,7 +798,7 @@ impl ProbabilisticScoringDecayParameters {
797
798
/// Direction is defined in terms of [`NodeId`] partial ordering, where the source node is the
798
799
/// first node in the ordering of the channel's counterparties. Thus, swapping the two liquidity
799
800
/// offset fields gives the opposite direction.
800
- struct ChannelLiquidity < T : Time > {
801
+ struct ChannelLiquidity {
801
802
/// Lower channel liquidity bound in terms of an offset from zero.
802
803
min_liquidity_offset_msat : u64 ,
803
804
@@ -807,23 +808,22 @@ struct ChannelLiquidity<T: Time> {
807
808
min_liquidity_offset_history : HistoricalBucketRangeTracker ,
808
809
max_liquidity_offset_history : HistoricalBucketRangeTracker ,
809
810
810
- /// Time when the liquidity bounds were last modified.
811
- last_updated : T ,
811
+ /// Time when the liquidity bounds were last modified as an offset since the unix epoch .
812
+ last_updated : Duration ,
812
813
813
- /// Time when the historical liquidity bounds were last modified.
814
- offset_history_last_updated : T ,
814
+ /// Time when the historical liquidity bounds were last modified as an offset against the unix
815
+ /// epoch.
816
+ offset_history_last_updated : Duration ,
815
817
}
816
818
817
- /// A snapshot of [`ChannelLiquidity`] in one direction assuming a certain channel capacity and
818
- /// decayed with a given half life.
819
- struct DirectedChannelLiquidity < L : Deref < Target = u64 > , BRT : Deref < Target = HistoricalBucketRangeTracker > , T : Time , U : Deref < Target = T > > {
819
+ /// A snapshot of [`ChannelLiquidity`] in one direction assuming a certain channel capacity.
820
+ struct DirectedChannelLiquidity < L : Deref < Target = u64 > , BRT : Deref < Target = HistoricalBucketRangeTracker > , T : Deref < Target = Duration > > {
820
821
min_liquidity_offset_msat : L ,
821
822
max_liquidity_offset_msat : L ,
822
823
liquidity_history : HistoricalMinMaxBuckets < BRT > ,
823
824
capacity_msat : u64 ,
824
- last_updated : U ,
825
- offset_history_last_updated : U ,
826
- now : T ,
825
+ last_updated : T ,
826
+ offset_history_last_updated : T ,
827
827
decay_params : ProbabilisticScoringDecayParameters ,
828
828
}
829
829
@@ -836,11 +836,12 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ProbabilisticScorerU
836
836
network_graph,
837
837
logger,
838
838
channel_liquidities : HashMap :: new ( ) ,
839
+ _unused_time : core:: marker:: PhantomData ,
839
840
}
840
841
}
841
842
842
843
#[ cfg( test) ]
843
- fn with_channel ( mut self , short_channel_id : u64 , liquidity : ChannelLiquidity < T > ) -> Self {
844
+ fn with_channel ( mut self , short_channel_id : u64 , liquidity : ChannelLiquidity ) -> Self {
844
845
assert ! ( self . channel_liquidities. insert( short_channel_id, liquidity) . is_none( ) ) ;
845
846
self
846
847
}
@@ -993,24 +994,23 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ProbabilisticScorerU
993
994
}
994
995
}
995
996
996
- impl < T : Time > ChannelLiquidity < T > {
997
- #[ inline]
998
- fn new ( ) -> Self {
997
+ impl ChannelLiquidity {
998
+ fn new ( last_updated : Duration ) -> Self {
999
999
Self {
1000
1000
min_liquidity_offset_msat : 0 ,
1001
1001
max_liquidity_offset_msat : 0 ,
1002
1002
min_liquidity_offset_history : HistoricalBucketRangeTracker :: new ( ) ,
1003
1003
max_liquidity_offset_history : HistoricalBucketRangeTracker :: new ( ) ,
1004
- last_updated : T :: now ( ) ,
1005
- offset_history_last_updated : T :: now ( ) ,
1004
+ last_updated,
1005
+ offset_history_last_updated : last_updated ,
1006
1006
}
1007
1007
}
1008
1008
1009
1009
/// Returns a view of the channel liquidity directed from `source` to `target` assuming
1010
1010
/// `capacity_msat`.
1011
1011
fn as_directed (
1012
1012
& self , source : & NodeId , target : & NodeId , capacity_msat : u64 , decay_params : ProbabilisticScoringDecayParameters
1013
- ) -> DirectedChannelLiquidity < & u64 , & HistoricalBucketRangeTracker , T , & T > {
1013
+ ) -> DirectedChannelLiquidity < & u64 , & HistoricalBucketRangeTracker , & Duration > {
1014
1014
let ( min_liquidity_offset_msat, max_liquidity_offset_msat, min_liquidity_offset_history, max_liquidity_offset_history) =
1015
1015
if source < target {
1016
1016
( & self . min_liquidity_offset_msat , & self . max_liquidity_offset_msat ,
@@ -1030,7 +1030,6 @@ impl<T: Time> ChannelLiquidity<T> {
1030
1030
capacity_msat,
1031
1031
last_updated : & self . last_updated ,
1032
1032
offset_history_last_updated : & self . offset_history_last_updated ,
1033
- now : T :: now ( ) ,
1034
1033
decay_params : decay_params,
1035
1034
}
1036
1035
}
@@ -1039,7 +1038,7 @@ impl<T: Time> ChannelLiquidity<T> {
1039
1038
/// `capacity_msat`.
1040
1039
fn as_directed_mut (
1041
1040
& mut self , source : & NodeId , target : & NodeId , capacity_msat : u64 , decay_params : ProbabilisticScoringDecayParameters
1042
- ) -> DirectedChannelLiquidity < & mut u64 , & mut HistoricalBucketRangeTracker , T , & mut T > {
1041
+ ) -> DirectedChannelLiquidity < & mut u64 , & mut HistoricalBucketRangeTracker , & mut Duration > {
1043
1042
let ( min_liquidity_offset_msat, max_liquidity_offset_msat, min_liquidity_offset_history, max_liquidity_offset_history) =
1044
1043
if source < target {
1045
1044
( & mut self . min_liquidity_offset_msat , & mut self . max_liquidity_offset_msat ,
@@ -1059,7 +1058,6 @@ impl<T: Time> ChannelLiquidity<T> {
1059
1058
capacity_msat,
1060
1059
last_updated : & mut self . last_updated ,
1061
1060
offset_history_last_updated : & mut self . offset_history_last_updated ,
1062
- now : T :: now ( ) ,
1063
1061
decay_params : decay_params,
1064
1062
}
1065
1063
}
@@ -1070,7 +1068,7 @@ impl<T: Time> ChannelLiquidity<T> {
1070
1068
) -> u64 {
1071
1069
let half_life = decay_params. liquidity_offset_half_life . as_secs_f64 ( ) ;
1072
1070
if half_life != 0.0 {
1073
- let elapsed_time = T :: now ( ) . duration_since ( self . last_updated ) . as_secs_f64 ( ) ;
1071
+ let elapsed_time = duration_since_epoch . saturating_sub ( self . last_updated ) . as_secs_f64 ( ) ;
1074
1072
( ( offset as f64 ) * powf64 ( 0.5 , elapsed_time / half_life) ) as u64
1075
1073
} else {
1076
1074
0
@@ -1159,7 +1157,8 @@ fn success_probability(
1159
1157
( numerator, denominator)
1160
1158
}
1161
1159
1162
- impl < L : Deref < Target = u64 > , BRT : Deref < Target = HistoricalBucketRangeTracker > , T : Time , U : Deref < Target = T > > DirectedChannelLiquidity < L , BRT , T , U > {
1160
+ impl < L : Deref < Target = u64 > , BRT : Deref < Target = HistoricalBucketRangeTracker > , T : Deref < Target = Duration > >
1161
+ DirectedChannelLiquidity < L , BRT , T > {
1163
1162
/// Returns a liquidity penalty for routing the given HTLC `amount_msat` through the channel in
1164
1163
/// this direction.
1165
1164
fn penalty_msat ( & self , amount_msat : u64 , score_params : & ProbabilisticScoringFeeParameters ) -> u64 {
@@ -1267,7 +1266,8 @@ impl<L: Deref<Target = u64>, BRT: Deref<Target = HistoricalBucketRangeTracker>,
1267
1266
}
1268
1267
}
1269
1268
1270
- impl < L : DerefMut < Target = u64 > , BRT : DerefMut < Target = HistoricalBucketRangeTracker > , T : Time , U : DerefMut < Target = T > > DirectedChannelLiquidity < L , BRT , T , U > {
1269
+ impl < L : DerefMut < Target = u64 > , BRT : DerefMut < Target = HistoricalBucketRangeTracker > , T : DerefMut < Target = Duration > >
1270
+ DirectedChannelLiquidity < L , BRT , T > {
1271
1271
/// Adjusts the channel liquidity balance bounds when failing to route `amount_msat`.
1272
1272
fn failed_at_channel < Log : Deref > (
1273
1273
& mut self , amount_msat : u64 , duration_since_epoch : Duration , chan_descr : fmt:: Arguments , logger : & Log
@@ -1313,7 +1313,9 @@ impl<L: DerefMut<Target = u64>, BRT: DerefMut<Target = HistoricalBucketRangeTrac
1313
1313
/// state"), we allow the caller to set an offset applied to our liquidity bounds which
1314
1314
/// represents the amount of the successful payment we just made.
1315
1315
fn update_history_buckets ( & mut self , bucket_offset_msat : u64 , duration_since_epoch : Duration ) {
1316
- let half_lives = self . now . duration_since ( * self . offset_history_last_updated ) . as_secs ( )
1316
+ let half_lives =
1317
+ duration_since_epoch. checked_sub ( * self . offset_history_last_updated )
1318
+ . unwrap_or ( Duration :: ZERO ) . as_secs ( )
1317
1319
. checked_div ( self . decay_params . historical_no_updates_half_life . as_secs ( ) )
1318
1320
. map ( |v| v. try_into ( ) . unwrap_or ( u32:: max_value ( ) ) ) . unwrap_or ( u32:: max_value ( ) ) ;
1319
1321
self . liquidity_history . min_liquidity_offset_history . time_decay_data ( half_lives) ;
@@ -1327,29 +1329,25 @@ impl<L: DerefMut<Target = u64>, BRT: DerefMut<Target = HistoricalBucketRangeTrac
1327
1329
self . liquidity_history . max_liquidity_offset_history . track_datapoint (
1328
1330
max_liquidity_offset_msat. saturating_sub ( bucket_offset_msat) , self . capacity_msat
1329
1331
) ;
1330
- * self . offset_history_last_updated = self . now ;
1332
+ * self . offset_history_last_updated = duration_since_epoch ;
1331
1333
}
1332
1334
1333
1335
/// Adjusts the lower bound of the channel liquidity balance in this direction.
1334
1336
fn set_min_liquidity_msat ( & mut self , amount_msat : u64 , duration_since_epoch : Duration ) {
1335
1337
* self . min_liquidity_offset_msat = amount_msat;
1336
- * self . max_liquidity_offset_msat = if amount_msat > self . max_liquidity_msat ( ) {
1337
- 0
1338
- } else {
1339
- self . decayed_offset_msat ( * self . max_liquidity_offset_msat )
1340
- } ;
1341
- * self . last_updated = self . now ;
1338
+ if amount_msat > self . max_liquidity_msat ( ) {
1339
+ * self . max_liquidity_offset_msat = 0 ;
1340
+ }
1341
+ * self . last_updated = duration_since_epoch;
1342
1342
}
1343
1343
1344
1344
/// Adjusts the upper bound of the channel liquidity balance in this direction.
1345
1345
fn set_max_liquidity_msat ( & mut self , amount_msat : u64 , duration_since_epoch : Duration ) {
1346
1346
* self . max_liquidity_offset_msat = self . capacity_msat . checked_sub ( amount_msat) . unwrap_or ( 0 ) ;
1347
- * self . min_liquidity_offset_msat = if amount_msat < self . min_liquidity_msat ( ) {
1348
- 0
1349
- } else {
1350
- self . decayed_offset_msat ( * self . min_liquidity_offset_msat )
1351
- } ;
1352
- * self . last_updated = self . now ;
1347
+ if amount_msat < * self . min_liquidity_offset_msat {
1348
+ * self . min_liquidity_offset_msat = 0 ;
1349
+ }
1350
+ * self . last_updated = duration_since_epoch;
1353
1351
}
1354
1352
}
1355
1353
@@ -1396,7 +1394,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreLookUp for Prob
1396
1394
let capacity_msat = usage. effective_capacity . as_msat ( ) ;
1397
1395
self . channel_liquidities
1398
1396
. get ( & scid)
1399
- . unwrap_or ( & ChannelLiquidity :: new ( ) )
1397
+ . unwrap_or ( & ChannelLiquidity :: new ( Duration :: ZERO ) )
1400
1398
. as_directed ( & source, & target, capacity_msat, self . decay_params )
1401
1399
. penalty_msat ( amount_msat, score_params)
1402
1400
. saturating_add ( anti_probing_penalty_msat)
@@ -1426,14 +1424,14 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreUpdate for Prob
1426
1424
if at_failed_channel {
1427
1425
self . channel_liquidities
1428
1426
. entry ( hop. short_channel_id )
1429
- . or_insert_with ( ChannelLiquidity :: new)
1427
+ . or_insert_with ( || ChannelLiquidity :: new ( duration_since_epoch ) )
1430
1428
. as_directed_mut ( source, & target, capacity_msat, self . decay_params )
1431
1429
. failed_at_channel ( amount_msat, duration_since_epoch,
1432
1430
format_args ! ( "SCID {}, towards {:?}" , hop. short_channel_id, target) , & self . logger ) ;
1433
1431
} else {
1434
1432
self . channel_liquidities
1435
1433
. entry ( hop. short_channel_id )
1436
- . or_insert_with ( ChannelLiquidity :: new)
1434
+ . or_insert_with ( || ChannelLiquidity :: new ( duration_since_epoch ) )
1437
1435
. as_directed_mut ( source, & target, capacity_msat, self . decay_params )
1438
1436
. failed_downstream ( amount_msat, duration_since_epoch,
1439
1437
format_args ! ( "SCID {}, towards {:?}" , hop. short_channel_id, target) , & self . logger ) ;
@@ -1462,7 +1460,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreUpdate for Prob
1462
1460
let capacity_msat = channel. effective_capacity ( ) . as_msat ( ) ;
1463
1461
self . channel_liquidities
1464
1462
. entry ( hop. short_channel_id )
1465
- . or_insert_with ( ChannelLiquidity :: new)
1463
+ . or_insert_with ( || ChannelLiquidity :: new ( duration_since_epoch ) )
1466
1464
. as_directed_mut ( source, & target, capacity_msat, self . decay_params )
1467
1465
. successful ( amount_msat, duration_since_epoch,
1468
1466
format_args ! ( "SCID {}, towards {:?}" , hop. short_channel_id, target) , & self . logger ) ;
@@ -1488,10 +1486,10 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreUpdate for Prob
1488
1486
liquidity. decayed_offset ( liquidity. min_liquidity_offset_msat , duration_since_epoch, decay_params) ;
1489
1487
liquidity. max_liquidity_offset_msat =
1490
1488
liquidity. decayed_offset ( liquidity. max_liquidity_offset_msat , duration_since_epoch, decay_params) ;
1491
- liquidity. last_updated = T :: now ( ) ;
1489
+ liquidity. last_updated = duration_since_epoch ;
1492
1490
1493
1491
let elapsed_time =
1494
- T :: now ( ) . duration_since ( liquidity. offset_history_last_updated ) ;
1492
+ duration_since_epoch . saturating_sub ( liquidity. offset_history_last_updated ) ;
1495
1493
if elapsed_time > decay_params. historical_no_updates_half_life {
1496
1494
let half_life = decay_params. historical_no_updates_half_life . as_secs_f64 ( ) ;
1497
1495
if half_life != 0.0 {
@@ -1502,7 +1500,7 @@ impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreUpdate for Prob
1502
1500
for bucket in liquidity. max_liquidity_offset_history . buckets . iter_mut ( ) {
1503
1501
* bucket = ( ( * bucket as u64 ) * 1024 / divisor) as u16 ;
1504
1502
}
1505
- liquidity. offset_history_last_updated = T :: now ( ) ;
1503
+ liquidity. offset_history_last_updated = duration_since_epoch ;
1506
1504
}
1507
1505
}
1508
1506
liquidity. min_liquidity_offset_msat != 0 || liquidity. max_liquidity_offset_msat != 0 ||
@@ -2125,31 +2123,29 @@ ReadableArgs<(ProbabilisticScoringDecayParameters, G, L)> for ProbabilisticScore
2125
2123
network_graph,
2126
2124
logger,
2127
2125
channel_liquidities,
2126
+ _unused_time : core:: marker:: PhantomData ,
2128
2127
} )
2129
2128
}
2130
2129
}
2131
2130
2132
- impl < T : Time > Writeable for ChannelLiquidity < T > {
2131
+ impl Writeable for ChannelLiquidity {
2133
2132
#[ inline]
2134
2133
fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , io:: Error > {
2135
- let offset_history_duration_since_epoch =
2136
- T :: duration_since_epoch ( ) - self . offset_history_last_updated . elapsed ( ) ;
2137
- let duration_since_epoch = T :: duration_since_epoch ( ) - self . last_updated . elapsed ( ) ;
2138
2134
write_tlv_fields ! ( w, {
2139
2135
( 0 , self . min_liquidity_offset_msat, required) ,
2140
2136
// 1 was the min_liquidity_offset_history in octile form
2141
2137
( 2 , self . max_liquidity_offset_msat, required) ,
2142
2138
// 3 was the max_liquidity_offset_history in octile form
2143
- ( 4 , duration_since_epoch , required) ,
2139
+ ( 4 , self . last_updated , required) ,
2144
2140
( 5 , Some ( self . min_liquidity_offset_history) , option) ,
2145
2141
( 7 , Some ( self . max_liquidity_offset_history) , option) ,
2146
- ( 9 , offset_history_duration_since_epoch , required) ,
2142
+ ( 9 , self . offset_history_last_updated , required) ,
2147
2143
} ) ;
2148
2144
Ok ( ( ) )
2149
2145
}
2150
2146
}
2151
2147
2152
- impl < T : Time > Readable for ChannelLiquidity < T > {
2148
+ impl Readable for ChannelLiquidity {
2153
2149
#[ inline]
2154
2150
fn read < R : Read > ( r : & mut R ) -> Result < Self , DecodeError > {
2155
2151
let mut min_liquidity_offset_msat = 0 ;
@@ -2158,36 +2154,18 @@ impl<T: Time> Readable for ChannelLiquidity<T> {
2158
2154
let mut legacy_max_liq_offset_history: Option < LegacyHistoricalBucketRangeTracker > = None ;
2159
2155
let mut min_liquidity_offset_history: Option < HistoricalBucketRangeTracker > = None ;
2160
2156
let mut max_liquidity_offset_history: Option < HistoricalBucketRangeTracker > = None ;
2161
- let mut duration_since_epoch = Duration :: from_secs ( 0 ) ;
2162
- let mut offset_history_duration_since_epoch = None ;
2157
+ let mut last_updated = Duration :: from_secs ( 0 ) ;
2158
+ let mut offset_history_last_updated = None ;
2163
2159
read_tlv_fields ! ( r, {
2164
2160
( 0 , min_liquidity_offset_msat, required) ,
2165
2161
( 1 , legacy_min_liq_offset_history, option) ,
2166
2162
( 2 , max_liquidity_offset_msat, required) ,
2167
2163
( 3 , legacy_max_liq_offset_history, option) ,
2168
- ( 4 , duration_since_epoch , required) ,
2164
+ ( 4 , last_updated , required) ,
2169
2165
( 5 , min_liquidity_offset_history, option) ,
2170
2166
( 7 , max_liquidity_offset_history, option) ,
2171
- ( 9 , offset_history_duration_since_epoch , option) ,
2167
+ ( 9 , offset_history_last_updated , option) ,
2172
2168
} ) ;
2173
- // On rust prior to 1.60 `Instant::duration_since` will panic if time goes backwards.
2174
- // We write `last_updated` as wallclock time even though its ultimately an `Instant` (which
2175
- // is a time from a monotonic clock usually represented as an offset against boot time).
2176
- // Thus, we have to construct an `Instant` by subtracting the difference in wallclock time
2177
- // from the one that was written. However, because `Instant` can panic if we construct one
2178
- // in the future, we must handle wallclock time jumping backwards, which we do by simply
2179
- // using `Instant::now()` in that case.
2180
- let wall_clock_now = T :: duration_since_epoch ( ) ;
2181
- let now = T :: now ( ) ;
2182
- let last_updated = if wall_clock_now > duration_since_epoch {
2183
- now - ( wall_clock_now - duration_since_epoch)
2184
- } else { now } ;
2185
-
2186
- let offset_history_duration_since_epoch =
2187
- offset_history_duration_since_epoch. unwrap_or ( duration_since_epoch) ;
2188
- let offset_history_last_updated = if wall_clock_now > offset_history_duration_since_epoch {
2189
- now - ( wall_clock_now - offset_history_duration_since_epoch)
2190
- } else { now } ;
2191
2169
2192
2170
if min_liquidity_offset_history. is_none ( ) {
2193
2171
if let Some ( legacy_buckets) = legacy_min_liq_offset_history {
@@ -2209,7 +2187,7 @@ impl<T: Time> Readable for ChannelLiquidity<T> {
2209
2187
min_liquidity_offset_history : min_liquidity_offset_history. unwrap ( ) ,
2210
2188
max_liquidity_offset_history : max_liquidity_offset_history. unwrap ( ) ,
2211
2189
last_updated,
2212
- offset_history_last_updated,
2190
+ offset_history_last_updated : offset_history_last_updated . unwrap_or ( last_updated ) ,
2213
2191
} )
2214
2192
}
2215
2193
}
@@ -2219,7 +2197,6 @@ mod tests {
2219
2197
use super :: { ChannelLiquidity , HistoricalBucketRangeTracker , ProbabilisticScoringFeeParameters , ProbabilisticScoringDecayParameters , ProbabilisticScorerUsingTime } ;
2220
2198
use crate :: blinded_path:: { BlindedHop , BlindedPath } ;
2221
2199
use crate :: util:: config:: UserConfig ;
2222
- use crate :: util:: time:: Time ;
2223
2200
use crate :: util:: time:: tests:: SinceEpoch ;
2224
2201
2225
2202
use crate :: ln:: channelmanager;
@@ -2384,8 +2361,8 @@ mod tests {
2384
2361
#[ test]
2385
2362
fn liquidity_bounds_directed_from_lowest_node_id ( ) {
2386
2363
let logger = TestLogger :: new ( ) ;
2387
- let last_updated = SinceEpoch :: now ( ) ;
2388
- let offset_history_last_updated = SinceEpoch :: now ( ) ;
2364
+ let last_updated = Duration :: ZERO ;
2365
+ let offset_history_last_updated = Duration :: ZERO ;
2389
2366
let network_graph = network_graph ( & logger) ;
2390
2367
let decay_params = ProbabilisticScoringDecayParameters :: default ( ) ;
2391
2368
let mut scorer = ProbabilisticScorer :: new ( decay_params, & network_graph, & logger)
@@ -2465,8 +2442,8 @@ mod tests {
2465
2442
#[ test]
2466
2443
fn resets_liquidity_upper_bound_when_crossed_by_lower_bound ( ) {
2467
2444
let logger = TestLogger :: new ( ) ;
2468
- let last_updated = SinceEpoch :: now ( ) ;
2469
- let offset_history_last_updated = SinceEpoch :: now ( ) ;
2445
+ let last_updated = Duration :: ZERO ;
2446
+ let offset_history_last_updated = Duration :: ZERO ;
2470
2447
let network_graph = network_graph ( & logger) ;
2471
2448
let decay_params = ProbabilisticScoringDecayParameters :: default ( ) ;
2472
2449
let mut scorer = ProbabilisticScorer :: new ( decay_params, & network_graph, & logger)
@@ -2526,8 +2503,8 @@ mod tests {
2526
2503
#[ test]
2527
2504
fn resets_liquidity_lower_bound_when_crossed_by_upper_bound ( ) {
2528
2505
let logger = TestLogger :: new ( ) ;
2529
- let last_updated = SinceEpoch :: now ( ) ;
2530
- let offset_history_last_updated = SinceEpoch :: now ( ) ;
2506
+ let last_updated = Duration :: ZERO ;
2507
+ let offset_history_last_updated = Duration :: ZERO ;
2531
2508
let network_graph = network_graph ( & logger) ;
2532
2509
let decay_params = ProbabilisticScoringDecayParameters :: default ( ) ;
2533
2510
let mut scorer = ProbabilisticScorer :: new ( decay_params, & network_graph, & logger)
@@ -2639,8 +2616,8 @@ mod tests {
2639
2616
#[ test]
2640
2617
fn constant_penalty_outside_liquidity_bounds ( ) {
2641
2618
let logger = TestLogger :: new ( ) ;
2642
- let last_updated = SinceEpoch :: now ( ) ;
2643
- let offset_history_last_updated = SinceEpoch :: now ( ) ;
2619
+ let last_updated = Duration :: ZERO ;
2620
+ let offset_history_last_updated = Duration :: ZERO ;
2644
2621
let network_graph = network_graph ( & logger) ;
2645
2622
let params = ProbabilisticScoringFeeParameters {
2646
2623
liquidity_penalty_multiplier_msat : 1_000 ,
0 commit comments