mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
CommitteeCache.initialized: fail early if possible (#4556)
This commit is contained in:
@@ -56,6 +56,11 @@ impl CommitteeCache {
|
||||
return Err(Error::ZeroSlotsPerEpoch);
|
||||
}
|
||||
|
||||
// The use of `NonZeroUsize` reduces the maximum number of possible validators by one.
|
||||
if state.validators().len() == usize::max_value() {
|
||||
return Err(Error::TooManyValidators);
|
||||
}
|
||||
|
||||
let active_validator_indices = get_active_validator_indices(state.validators(), epoch);
|
||||
|
||||
if active_validator_indices.is_empty() {
|
||||
@@ -75,11 +80,6 @@ impl CommitteeCache {
|
||||
)
|
||||
.ok_or(Error::UnableToShuffle)?;
|
||||
|
||||
// The use of `NonZeroUsize` reduces the maximum number of possible validators by one.
|
||||
if state.validators().len() == usize::max_value() {
|
||||
return Err(Error::TooManyValidators);
|
||||
}
|
||||
|
||||
let mut shuffling_positions = vec![<_>::default(); state.validators().len()];
|
||||
for (i, &v) in shuffling.iter().enumerate() {
|
||||
*shuffling_positions
|
||||
|
||||
Reference in New Issue
Block a user