]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Drop now-trivial `decayed_offset_msat` helper utility
authorMatt Corallo <git@bluematt.me>
Mon, 9 Oct 2023 02:21:09 +0000 (02:21 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 13 Dec 2023 23:26:09 +0000 (23:26 +0000)
As we now no longer decay bounds information when fetching them,
there is no need to have a decaying-fetching helper utility.

lightning/src/routing/scoring.rs

index 15193ad295273f352d7914047cfa7c243a815866..d6b1f44587f41dbc38df4a831b9018b62c792da8 100644 (file)
@@ -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<L, BRT, T> {
                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;
        }