/// <summary> /// Return the sequence of active validator indices at ``epoch``. /// </summary> public IList <ValidatorIndex> GetActiveValidatorIndices(BeaconState state, Epoch epoch) { return(state.Validators .Select((validator, index) => new { validator, index }) .Where(x => _beaconChainUtility.IsActiveValidator(x.validator, epoch)) .Select(x => (ValidatorIndex)(ulong)x.index) .ToList()); }
public bool CheckIfValidatorActive(BeaconState state, ValidatorIndex validatorIndex) { if ((int)validatorIndex >= state.Validators.Count) { return(false); } Validator validator = state.Validators[(int)validatorIndex]; Epoch currentEpoch = _beaconStateAccessor.GetCurrentEpoch(state); bool isActive = _beaconChainUtility.IsActiveValidator(validator, currentEpoch); return(isActive); }