Liquidator: fix an arithmetic error in client side health computation (#986)

This commit is contained in:
Serge Farny 2024-08-05 14:32:37 +01:00 committed by GitHub
parent 70bf435e56
commit f5b4bd9dd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -504,7 +504,10 @@ fn scan_right_until_less_than(
if value <= target {
return Ok(current);
}
current = current.max(I80F48::ONE) * I80F48::from(2);
let Some(new_current) = current.max(I80F48::ONE).checked_mul(I80F48::from(2)) else {
break;
};
current = new_current;
}
Err(error_msg!(
"could not find amount that lead to health ratio <= 0"