From 1b6ed725be4cf9e55280ad3433f135a90c7443e6 Mon Sep 17 00:00:00 2001 From: microwavedcola1 <89031858+microwavedcola1@users.noreply.github.com> Date: Sun, 14 Aug 2022 20:45:57 +0200 Subject: [PATCH] over explaining the code (#168) Signed-off-by: microwavedcola1 Signed-off-by: microwavedcola1 --- programs/mango-v4/src/instructions/liq_token_with_token.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/programs/mango-v4/src/instructions/liq_token_with_token.rs b/programs/mango-v4/src/instructions/liq_token_with_token.rs index 3a189f804..0c29d4e6c 100644 --- a/programs/mango-v4/src/instructions/liq_token_with_token.rs +++ b/programs/mango-v4/src/instructions/liq_token_with_token.rs @@ -54,6 +54,10 @@ pub fn liq_token_with_token( let mut liqee_health_cache = new_health_cache(&liqee.borrow(), &account_retriever) .context("create liqee health cache")?; let init_health = liqee_health_cache.health(HealthType::Init); + + // Once maint_health falls below 0, we want to start liquidating, + // we want to allow liquidation to continue until init_health is positive, + // to prevent constant oscillation between the two states if liqee.being_liquidated() { if init_health > I80F48::ZERO { liqee.fixed.set_being_liquidated(false);