Skip to content

Commit

Permalink
Revert 56d4db423079cbe729b6df9d0d597cca2a68ddc5 (paritytech#315)
Browse files Browse the repository at this point in the history
* Revert 56d4db423079cbe729b6df9d0d597cca2a68ddc5

Refer to paritytech#295

* Build wasm
  • Loading branch information
liuchengxu authored Feb 21, 2019
1 parent c3b8991 commit 8bfc71c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
Binary file not shown.
19 changes: 3 additions & 16 deletions xrml/xmining/staking/src/shifter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,27 +221,14 @@ impl<T: Trait> Module<T> {

let desired_validator_count = <ValidatorCount<T>>::get() as usize;

let old_validators = <session::Module<T>>::validators();

let new_validators = candidates
let validators = candidates
.into_iter()
.take(desired_validator_count)
.map(|(stake_weight, account_id)| (account_id, stake_weight.as_()))
.collect::<Vec<(_, _)>>();

// Skip set validators when the validator set stays the same.
if old_validators.len() == new_validators.len()
&& old_validators
.iter()
.map(|(val, _)| val)
.zip(new_validators.iter().map(|(val, _)| val))
.all(|(a, b)| a == b)
{
return;
}

<session::Module<T>>::set_validators(&new_validators);
Self::deposit_event(RawEvent::Rotation(new_validators.clone()));
<session::Module<T>>::set_validators(&validators);
Self::deposit_event(RawEvent::Rotation(validators));
}

pub fn on_offline_validator(v: &T::AccountId) {
Expand Down

0 comments on commit 8bfc71c

Please sign in to comment.