From 2d1b61522b8e66461d61c1f6c6764d78f0cc44ef Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Thu, 10 Jan 2019 14:47:25 -0600 Subject: [PATCH] Uses the new `get_active_validator_indices` implementation --- beacon_chain/validator_shuffling/src/shuffle.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/beacon_chain/validator_shuffling/src/shuffle.rs b/beacon_chain/validator_shuffling/src/shuffle.rs index 5b31f8e03..13bdf97fe 100644 --- a/beacon_chain/validator_shuffling/src/shuffle.rs +++ b/beacon_chain/validator_shuffling/src/shuffle.rs @@ -2,7 +2,8 @@ use std::cmp::min; use honey_badger_split::SplitExt; use spec::ChainSpec; -use types::{ShardCommittee, ValidatorRecord, ValidatorStatus}; +use types::validator_registry::get_active_validator_indices; +use types::{ShardCommittee, ValidatorRecord}; use vec_shuffle::{shuffle, ShuffleErr}; type DelegatedCycle = Vec>; @@ -24,17 +25,7 @@ pub fn shard_and_committees_for_cycle( spec: &ChainSpec, ) -> Result { let shuffled_validator_indices = { - let validator_indices = validators - .iter() - .enumerate() - .filter_map(|(i, validator)| { - if validator.status_is(ValidatorStatus::Active) { - Some(i) - } else { - None - } - }) - .collect(); + let validator_indices = get_active_validator_indices(validators, 0); shuffle(seed, validator_indices)? }; let shard_indices: Vec = (0_usize..spec.shard_count as usize).into_iter().collect();