From c7884dd066a9299fc5337dc8ac8cc44fa300728f Mon Sep 17 00:00:00 2001 From: Zikun Fan Date: Mon, 30 Mar 2020 14:42:40 +0800 Subject: [PATCH] fix passive guarantor votes --- cstrml/staking/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cstrml/staking/src/lib.rs b/cstrml/staking/src/lib.rs index e5c3e9ea..99aa0477 100644 --- a/cstrml/staking/src/lib.rs +++ b/cstrml/staking/src/lib.rs @@ -1482,7 +1482,8 @@ impl Module { // 1. There still has credit for guarantors // we should using `FILO` rule to calculate others if remains > 0 { - let g_vote_stakes = to_balance(remains.min(votes)); + let g_real_votes = remains.min(votes); + let g_vote_stakes = to_balance(g_real_votes); // a. preparing new_guarantors for `Validators`, others for `Stakers` new_guarantors.push(guarantor.clone()); @@ -1491,8 +1492,8 @@ impl Module { value: g_vote_stakes, }); // b. update remains and guarantors votes - remains -= votes; - v_guarantors_votes += votes; + remains -= g_real_votes; + v_guarantors_votes += g_real_votes; // c. UPDATE EDGE: (maybe) update GuaranteeRel >::insert(&edge, g_vote_stakes);