From d31c9659760779ca5bbed995678cca88e59e981c Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Fri, 7 Jan 2022 08:19:45 -0600 Subject: [PATCH] f - Fix decay in mutators --- lightning/src/routing/scoring.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index 627b3dd0a..3577460ac 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -681,24 +681,24 @@ impl, T: Time, U: DerefMut> DirectedChanne /// Adjusts the lower bound of the channel liquidity balance in this direction. fn set_min_liquidity_msat(&mut self, amount_msat: u64) { - *self.last_updated = self.now; *self.min_liquidity_offset_msat = amount_msat; *self.max_liquidity_offset_msat = if amount_msat > self.max_liquidity_msat() { 0 } else { self.decayed_offset_msat(*self.max_liquidity_offset_msat) }; + *self.last_updated = self.now; } /// Adjusts the upper bound of the channel liquidity balance in this direction. fn set_max_liquidity_msat(&mut self, amount_msat: u64) { - *self.last_updated = self.now; *self.max_liquidity_offset_msat = self.capacity_msat.checked_sub(amount_msat).unwrap_or(0); *self.min_liquidity_offset_msat = if amount_msat < self.min_liquidity_msat() { 0 } else { self.decayed_offset_msat(*self.min_liquidity_offset_msat) - } + }; + *self.last_updated = self.now; } } -- 2.39.5