mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 06:14:38 +00:00
remove active_validators crate
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
extern crate active_validators;
|
||||
extern crate honey_badger_split;
|
||||
extern crate types;
|
||||
extern crate vec_shuffle;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use std::cmp::min;
|
||||
|
||||
use active_validators::active_validator_indices;
|
||||
use honey_badger_split::SplitExt;
|
||||
use types::{ChainConfig, ShardAndCommittee, ValidatorRecord};
|
||||
use types::{ChainConfig, ShardAndCommittee, ValidatorRecord, ValidatorStatus};
|
||||
use vec_shuffle::{shuffle, ShuffleErr};
|
||||
|
||||
type DelegatedCycle = Vec<Vec<ShardAndCommittee>>;
|
||||
@@ -24,7 +23,17 @@ pub fn shard_and_committees_for_cycle(
|
||||
config: &ChainConfig,
|
||||
) -> Result<DelegatedCycle, ValidatorAssignmentError> {
|
||||
let shuffled_validator_indices = {
|
||||
let mut validator_indices = active_validator_indices(validators);
|
||||
let mut validator_indices = validators
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(i, validator)| {
|
||||
if validator.status_is(ValidatorStatus::Active) {
|
||||
Some(i)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
shuffle(seed, validator_indices)?
|
||||
};
|
||||
let shard_indices: Vec<usize> = (0_usize..config.shard_count as usize).into_iter().collect();
|
||||
|
||||
Reference in New Issue
Block a user