mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
get_active_validator_indices() now has bound check (#1300)
This commit is contained in:
@@ -52,9 +52,12 @@ pub fn initialize_beacon_state_from_eth1<T: EthSpec>(
|
||||
///
|
||||
/// Spec v0.12.1
|
||||
pub fn is_valid_genesis_state<T: EthSpec>(state: &BeaconState<T>, spec: &ChainSpec) -> bool {
|
||||
state.genesis_time >= spec.min_genesis_time
|
||||
&& state.get_active_validator_indices(T::genesis_epoch()).len() as u64
|
||||
>= spec.min_genesis_active_validator_count
|
||||
state
|
||||
.get_active_validator_indices(T::genesis_epoch(), spec)
|
||||
.map_or(false, |active_validators| {
|
||||
state.genesis_time >= spec.min_genesis_time
|
||||
&& active_validators.len() as u64 >= spec.min_genesis_active_validator_count
|
||||
})
|
||||
}
|
||||
|
||||
/// Activate genesis validators, if their balance is acceptable.
|
||||
|
||||
Reference in New Issue
Block a user