Skip to content

Commit 45b871e

Browse files
committed
f rename fn
1 parent f6a6845 commit 45b871e

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

lightning/src/routing/scoring.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2978,7 +2978,7 @@ mod tests {
29782978

29792979
// Half decay (i.e., three-quarter life)
29802980
SinceEpoch::advance(Duration::from_secs(5));
2981-
scorer.decay_liquidity_certainty(Duration::from_secs(5));
2981+
scorer.time_passed(Duration::from_secs(5));
29822982
let usage = ChannelUsage { amount_msat: 128, ..usage };
29832983
assert_eq!(scorer.channel_penalty_msat(&candidate, usage, &params), 22);
29842984
let usage = ChannelUsage { amount_msat: 256, ..usage };
@@ -2990,7 +2990,7 @@ mod tests {
29902990

29912991
// One decay (i.e., half life)
29922992
SinceEpoch::advance(Duration::from_secs(5));
2993-
scorer.decay_liquidity_certainty(Duration::from_secs(10));
2993+
scorer.time_passed(Duration::from_secs(10));
29942994
let usage = ChannelUsage { amount_msat: 64, ..usage };
29952995
assert_eq!(scorer.channel_penalty_msat(&candidate, usage, &params), 0);
29962996
let usage = ChannelUsage { amount_msat: 128, ..usage };
@@ -3002,7 +3002,7 @@ mod tests {
30023002

30033003
// Fully decay liquidity lower bound.
30043004
SinceEpoch::advance(Duration::from_secs(10 * 7));
3005-
scorer.decay_liquidity_certainty(Duration::from_secs(10 * 8));
3005+
scorer.time_passed(Duration::from_secs(10 * 8));
30063006
let usage = ChannelUsage { amount_msat: 0, ..usage };
30073007
assert_eq!(scorer.channel_penalty_msat(&candidate, usage, &params), 0);
30083008
let usage = ChannelUsage { amount_msat: 1, ..usage };
@@ -3014,14 +3014,14 @@ mod tests {
30143014

30153015
// Fully decay liquidity upper bound.
30163016
SinceEpoch::advance(Duration::from_secs(10));
3017-
scorer.decay_liquidity_certainty(Duration::from_secs(10 * 9));
3017+
scorer.time_passed(Duration::from_secs(10 * 9));
30183018
let usage = ChannelUsage { amount_msat: 0, ..usage };
30193019
assert_eq!(scorer.channel_penalty_msat(&candidate, usage, &params), 0);
30203020
let usage = ChannelUsage { amount_msat: 1_024, ..usage };
30213021
assert_eq!(scorer.channel_penalty_msat(&candidate, usage, &params), u64::max_value());
30223022

30233023
SinceEpoch::advance(Duration::from_secs(10));
3024-
scorer.decay_liquidity_certainty(Duration::from_secs(10 * 10));
3024+
scorer.time_passed(Duration::from_secs(10 * 10));
30253025
let usage = ChannelUsage { amount_msat: 0, ..usage };
30263026
assert_eq!(scorer.channel_penalty_msat(&candidate, usage, &params), 0);
30273027
let usage = ChannelUsage { amount_msat: 1_024, ..usage };
@@ -3061,11 +3061,11 @@ mod tests {
30613061
// An unchecked right shift 64 bits or more in DirectedChannelLiquidity::decayed_offset_msat
30623062
// would cause an overflow.
30633063
SinceEpoch::advance(Duration::from_secs(10 * 64));
3064-
scorer.decay_liquidity_certainty(Duration::from_secs(10 * 64));
3064+
scorer.time_passed(Duration::from_secs(10 * 64));
30653065
assert_eq!(scorer.channel_penalty_msat(&candidate, usage, &params), 125);
30663066

30673067
SinceEpoch::advance(Duration::from_secs(10));
3068-
scorer.decay_liquidity_certainty(Duration::from_secs(10 * 65));
3068+
scorer.time_passed(Duration::from_secs(10 * 65));
30693069
assert_eq!(scorer.channel_penalty_msat(&candidate, usage, &params), 125);
30703070
}
30713071

@@ -3104,7 +3104,7 @@ mod tests {
31043104

31053105
// Decaying knowledge gives less confidence (128, 896), meaning a higher penalty.
31063106
SinceEpoch::advance(Duration::from_secs(10));
3107-
scorer.decay_liquidity_certainty(Duration::from_secs(10));
3107+
scorer.time_passed(Duration::from_secs(10));
31083108
assert_eq!(scorer.channel_penalty_msat(&candidate, usage, &params), 291);
31093109

31103110
// Reducing the upper bound gives more confidence (128, 832) that the payment amount (512)
@@ -3119,7 +3119,7 @@ mod tests {
31193119

31203120
// Further decaying affects the lower bound more than the upper bound (128, 928).
31213121
SinceEpoch::advance(Duration::from_secs(10));
3122-
scorer.decay_liquidity_certainty(Duration::from_secs(20));
3122+
scorer.time_passed(Duration::from_secs(20));
31233123
assert_eq!(scorer.channel_penalty_msat(&candidate, usage, &params), 280);
31243124
}
31253125

@@ -3154,7 +3154,7 @@ mod tests {
31543154
assert_eq!(scorer.channel_penalty_msat(&candidate, usage, &params), u64::max_value());
31553155

31563156
SinceEpoch::advance(Duration::from_secs(10));
3157-
scorer.decay_liquidity_certainty(Duration::from_secs(10));
3157+
scorer.time_passed(Duration::from_secs(10));
31583158
assert_eq!(scorer.channel_penalty_msat(&candidate, usage, &params), 473);
31593159

31603160
scorer.payment_path_failed(&payment_path_for_amount(250), 43, Duration::from_secs(10));
@@ -3200,7 +3200,7 @@ mod tests {
32003200

32013201
if decay_before_reload {
32023202
SinceEpoch::advance(Duration::from_secs(10));
3203-
scorer.decay_liquidity_certainty(Duration::from_secs(10));
3203+
scorer.time_passed(Duration::from_secs(10));
32043204
}
32053205

32063206
let mut serialized_scorer = Vec::new();
@@ -3211,16 +3211,16 @@ mod tests {
32113211
<ProbabilisticScorer>::read(&mut serialized_scorer, (decay_params, &network_graph, &logger)).unwrap();
32123212
if !decay_before_reload {
32133213
SinceEpoch::advance(Duration::from_secs(10));
3214-
scorer.decay_liquidity_certainty(Duration::from_secs(10));
3215-
deserialized_scorer.decay_liquidity_certainty(Duration::from_secs(10));
3214+
scorer.time_passed(Duration::from_secs(10));
3215+
deserialized_scorer.time_passed(Duration::from_secs(10));
32163216
}
32173217
assert_eq!(deserialized_scorer.channel_penalty_msat(&candidate, usage, &params), 473);
32183218

32193219
scorer.payment_path_failed(&payment_path_for_amount(250), 43, Duration::from_secs(10));
32203220
assert_eq!(scorer.channel_penalty_msat(&candidate, usage, &params), 300);
32213221

32223222
SinceEpoch::advance(Duration::from_secs(10));
3223-
deserialized_scorer.decay_liquidity_certainty(Duration::from_secs(20));
3223+
deserialized_scorer.time_passed(Duration::from_secs(20));
32243224
assert_eq!(deserialized_scorer.channel_penalty_msat(&candidate, usage, &params), 370);
32253225
}
32263226

@@ -3554,7 +3554,7 @@ mod tests {
35543554
// Advance the time forward 16 half-lives (which the docs claim will ensure all data is
35553555
// gone), and check that we're back to where we started.
35563556
SinceEpoch::advance(Duration::from_secs(10 * 16));
3557-
scorer.decay_liquidity_certainty(Duration::from_secs(10 * 16));
3557+
scorer.time_passed(Duration::from_secs(10 * 16));
35583558
{
35593559
let network_graph = network_graph.read_only();
35603560
let channel = network_graph.channel(42).unwrap();
@@ -3599,7 +3599,7 @@ mod tests {
35993599

36003600
// Advance to decay all liquidity offsets to zero.
36013601
SinceEpoch::advance(Duration::from_secs(60 * 60 * 10));
3602-
scorer.decay_liquidity_certainty(Duration::from_secs(10 * (16 + 60 * 60)));
3602+
scorer.time_passed(Duration::from_secs(10 * (16 + 60 * 60)));
36033603

36043604
// Once even the bounds have decayed information about the channel should be removed
36053605
// entirely.

0 commit comments

Comments
 (0)