From: Matt Corallo Date: Mon, 9 Oct 2023 02:21:09 +0000 (+0000) Subject: Drop now-trivial `decayed_offset_msat` helper utility X-Git-Tag: v0.0.119~4^2~5 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=512f44cf15b70412d0023fad8cfa39260536c0fe;p=rust-lightning Drop now-trivial `decayed_offset_msat` helper utility As we now no longer decay bounds information when fetching them, there is no need to have a decaying-fetching helper utility. --- diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index 15193ad29..d6b1f4458 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -1236,18 +1236,14 @@ DirectedChannelLiquidity< L, BRT, T> { /// Returns the lower bound of the channel liquidity balance in this direction. #[inline(always)] fn min_liquidity_msat(&self) -> u64 { - self.decayed_offset_msat(*self.min_liquidity_offset_msat) + *self.min_liquidity_offset_msat } /// Returns the upper bound of the channel liquidity balance in this direction. #[inline(always)] fn max_liquidity_msat(&self) -> u64 { self.capacity_msat - .saturating_sub(self.decayed_offset_msat(*self.max_liquidity_offset_msat)) - } - - fn decayed_offset_msat(&self, offset_msat: u64) -> u64 { - offset_msat + .saturating_sub(*self.max_liquidity_offset_msat) } } @@ -1306,13 +1302,11 @@ DirectedChannelLiquidity { self.liquidity_history.min_liquidity_offset_history.time_decay_data(half_lives); self.liquidity_history.max_liquidity_offset_history.time_decay_data(half_lives); - let min_liquidity_offset_msat = self.decayed_offset_msat(*self.min_liquidity_offset_msat); self.liquidity_history.min_liquidity_offset_history.track_datapoint( - min_liquidity_offset_msat + bucket_offset_msat, self.capacity_msat + *self.min_liquidity_offset_msat + bucket_offset_msat, self.capacity_msat ); - let max_liquidity_offset_msat = self.decayed_offset_msat(*self.max_liquidity_offset_msat); self.liquidity_history.max_liquidity_offset_history.track_datapoint( - max_liquidity_offset_msat.saturating_sub(bucket_offset_msat), self.capacity_msat + self.max_liquidity_offset_msat.saturating_sub(bucket_offset_msat), self.capacity_msat ); *self.offset_history_last_updated = duration_since_epoch; }