Skip to content

Commit 29f2d2a

Browse files
committed
f more decay docs
1 parent 4775973 commit 29f2d2a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lightning/src/routing/scoring.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,9 @@ impl HistoricalBucketRangeTracker {
512512
}
513513
}
514514
}
515-
fn decay_data(&mut self, half_lives: u32) {
515+
/// Decay all buckets by the given number of half-lives. Used to more aggressively remove old
516+
/// datapoints as we receive newer information.
517+
fn time_decay_data(&mut self, half_lives: u32) {
516518
for e in self.buckets.iter_mut() {
517519
*e = e.checked_shr(half_lives).unwrap_or(0);
518520
}
@@ -948,8 +950,8 @@ impl<L: DerefMut<Target = u64>, BRT: DerefMut<Target = HistoricalBucketRangeTrac
948950
let half_lives = self.now.duration_since(*self.last_updated).as_secs()
949951
.checked_div(self.params.historical_no_updates_half_life.as_secs())
950952
.map(|v| v.try_into().unwrap_or(u32::max_value())).unwrap_or(u32::max_value());
951-
self.min_liquidity_offset_history.decay_data(half_lives);
952-
self.max_liquidity_offset_history.decay_data(half_lives);
953+
self.min_liquidity_offset_history.time_decay_data(half_lives);
954+
self.max_liquidity_offset_history.time_decay_data(half_lives);
953955

954956
debug_assert!(*self.min_liquidity_offset_msat <= self.capacity_msat);
955957
self.min_liquidity_offset_history.track_datapoint(

0 commit comments

Comments
 (0)