Skip to content

Commit

Permalink
f decays a bit more concise
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlueMatt committed Aug 30, 2022
1 parent 29f2d2a commit 9896f67
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lightning/src/routing/scoring.rs
Expand Up @@ -823,8 +823,7 @@ impl<L: Deref<Target = u64>, BRT: Deref<Target = HistoricalBucketRangeTracker>,
let mut total_valid_points_tracked = 0;
let decays = self.now.duration_since(*self.last_updated).as_secs()
.checked_div(params.historical_no_updates_half_life.as_secs())
.map(|decays| cmp::min(decays, u32::max_value() as u64) as u32)
.unwrap_or(u32::max_value());
.map_or(u32::max_value(), |decays| cmp::min(decays, u32::max_value() as u64) as u32);
// Rather than actually decaying the individual buckets, which would lose precision, we
// simply track whether any buckets have data which wouldn't be decayed to zero, and if
// there are none, treat it as if we had no data.
Expand Down

0 comments on commit 9896f67

Please sign in to comment.