Skip to content

Commit

Permalink
fix passive guarantor votes (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
badkk authored Mar 30, 2020
1 parent f2d5b37 commit 1a95e89
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cstrml/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,8 @@ impl<T: Trait> Module<T> {
// 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());
Expand All @@ -1491,8 +1492,8 @@ impl<T: Trait> Module<T> {
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
<GuaranteeRel<T>>::insert(&edge, g_vote_stakes);
Expand Down

0 comments on commit 1a95e89

Please sign in to comment.