Skip to content

Commit e8ade59

Browse files
committed
validator_worker - follower_rules - health_threshold argument of is_healthy
1 parent 6552837 commit e8ade59

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

validator_worker/src/core/follower_rules.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn is_healthy(
1919
channel: &Channel,
2020
our: &BalancesMap,
2121
approved: &BalancesMap,
22-
health_threshold_neg: BigNum,
22+
health_threshold: BigNum,
2323
) -> bool {
2424
let sum_our: BigNum = our.values().sum();
2525

@@ -34,6 +34,7 @@ pub fn is_healthy(
3434
}
3535

3636
let deposit = &channel.deposit_amount;
37+
let health_threshold_neg = BigNum::from(1_000) - health_threshold;
3738
let acceptable_difference = deposit * &health_threshold_neg / &BigNum::from(1_000);
3839

3940
sum_our - sum_approved_mins < acceptable_difference
@@ -45,7 +46,7 @@ mod test {
4546
use primitives::channel::fixtures::get_channel;
4647

4748
fn health_threshold() -> BigNum {
48-
(1000 - 950).into()
49+
950.into()
4950
}
5051

5152
fn get_dummy_channel<T: Into<BigNum>>(deposit: T) -> Channel {

0 commit comments

Comments
 (0)