Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix passive guarantor votes #84

Merged
merged 1 commit into from
Mar 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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