From 9896f67ad094114d391266587de90926f0c73c87 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 30 Aug 2022 17:12:17 +0000 Subject: [PATCH] f decays a bit more concise --- lightning/src/routing/scoring.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index c1fd2288595..9cf466a1c03 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -823,8 +823,7 @@ impl, BRT: Deref, 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.