mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-06 19:12:20 +00:00
Uses the new get_active_validator_indices
implementation
This commit is contained in:
parent
869f36ffbe
commit
2d1b61522b
@ -2,7 +2,8 @@ use std::cmp::min;
|
|||||||
|
|
||||||
use honey_badger_split::SplitExt;
|
use honey_badger_split::SplitExt;
|
||||||
use spec::ChainSpec;
|
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};
|
use vec_shuffle::{shuffle, ShuffleErr};
|
||||||
|
|
||||||
type DelegatedCycle = Vec<Vec<ShardCommittee>>;
|
type DelegatedCycle = Vec<Vec<ShardCommittee>>;
|
||||||
@ -24,17 +25,7 @@ pub fn shard_and_committees_for_cycle(
|
|||||||
spec: &ChainSpec,
|
spec: &ChainSpec,
|
||||||
) -> Result<DelegatedCycle, ValidatorAssignmentError> {
|
) -> Result<DelegatedCycle, ValidatorAssignmentError> {
|
||||||
let shuffled_validator_indices = {
|
let shuffled_validator_indices = {
|
||||||
let validator_indices = validators
|
let validator_indices = get_active_validator_indices(validators, 0);
|
||||||
.iter()
|
|
||||||
.enumerate()
|
|
||||||
.filter_map(|(i, validator)| {
|
|
||||||
if validator.status_is(ValidatorStatus::Active) {
|
|
||||||
Some(i)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
shuffle(seed, validator_indices)?
|
shuffle(seed, validator_indices)?
|
||||||
};
|
};
|
||||||
let shard_indices: Vec<usize> = (0_usize..spec.shard_count as usize).into_iter().collect();
|
let shard_indices: Vec<usize> = (0_usize..spec.shard_count as usize).into_iter().collect();
|
||||||
|
Loading…
Reference in New Issue
Block a user