コード例 #1
0
 /// <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());
 }
コード例 #2
0
        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);
        }