Skip to content

Commit

Permalink
f - Fix decay in mutators
Browse files Browse the repository at this point in the history
  • Loading branch information
jkczyz committed Jan 7, 2022
1 parent 5d14da3 commit 22d285d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lightning/src/routing/scoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,24 +682,24 @@ impl<L: DerefMut<Target = u64>, T: Time, U: DerefMut<Target = T>> 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;
}
}

Expand Down

0 comments on commit 22d285d

Please sign in to comment.