Exemplo n.º 1
0
        /// <summary>
        /// Return the beacon committee at ``slot`` for ``index``.
        /// </summary>
        public IReadOnlyList <ValidatorIndex> GetBeaconCommittee(BeaconState state, Slot slot, CommitteeIndex index)
        {
            Epoch epoch             = _beaconChainUtility.ComputeEpochAtSlot(slot);
            ulong committeesPerSlot = GetCommitteeCountAtSlot(state, slot);

            IList <ValidatorIndex> indices = GetActiveValidatorIndices(state, epoch);
            Bytes32 seed           = GetSeed(state, epoch, _signatureDomainOptions.CurrentValue.BeaconAttester);
            ulong   committeeIndex = (slot % _timeParameterOptions.CurrentValue.SlotsPerEpoch) * committeesPerSlot + (ulong)index;
            ulong   committeeCount = committeesPerSlot * _timeParameterOptions.CurrentValue.SlotsPerEpoch;

            IReadOnlyList <ValidatorIndex> committee = _beaconChainUtility.ComputeCommittee(indices, seed, committeeIndex, committeeCount);

            return(committee);
        }