mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 16:17:59 +00:00
Disable equalize, avoiding consensus issue (#4608)
* Disable equalize, avoiding consensus issue * Update frame/staking/Cargo.toml Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -1519,40 +1519,6 @@ impl<T: Trait> Module<T> {
|
||||
Self::slashable_balance_of,
|
||||
);
|
||||
|
||||
if cfg!(feature = "equalize") {
|
||||
let mut staked_assignments
|
||||
: Vec<(T::AccountId, Vec<PhragmenStakedAssignment<T::AccountId>>)>
|
||||
= Vec::with_capacity(assignments.len());
|
||||
for (n, assignment) in assignments.iter() {
|
||||
let mut staked_assignment
|
||||
: Vec<PhragmenStakedAssignment<T::AccountId>>
|
||||
= Vec::with_capacity(assignment.len());
|
||||
|
||||
// If this is a self vote, then we don't need to equalise it at all. While the
|
||||
// staking system does not allow nomination and validation at the same time,
|
||||
// this must always be 100% support.
|
||||
if assignment.len() == 1 && assignment[0].0 == *n {
|
||||
continue;
|
||||
}
|
||||
for (c, per_thing) in assignment.iter() {
|
||||
let nominator_stake = to_votes(Self::slashable_balance_of(n));
|
||||
let other_stake = *per_thing * nominator_stake;
|
||||
staked_assignment.push((c.clone(), other_stake));
|
||||
}
|
||||
staked_assignments.push((n.clone(), staked_assignment));
|
||||
}
|
||||
|
||||
let tolerance = 0_u128;
|
||||
let iterations = 2_usize;
|
||||
sp_phragmen::equalize::<_, _, T::CurrencyToVote, _>(
|
||||
staked_assignments,
|
||||
&mut supports,
|
||||
tolerance,
|
||||
iterations,
|
||||
Self::slashable_balance_of,
|
||||
);
|
||||
}
|
||||
|
||||
// Clear Stakers.
|
||||
for v in Self::current_elected().iter() {
|
||||
<Stakers<T>>::remove(v);
|
||||
|
||||
Reference in New Issue
Block a user