Fix current epoch committee count (#2099)

* fix current epoch committee count

* prev epoch
This commit is contained in:
terence tsao 2019-03-27 20:10:10 -07:00 committed by Raul Jordan
parent 839845645c
commit 761f3352a0

View File

@ -77,12 +77,12 @@ func EpochCommitteeCount(activeValidatorCount uint64) uint64 {
// """ // """
// current_active_validators = get_active_validator_indices( // current_active_validators = get_active_validator_indices(
// state.validator_registry, // state.validator_registry,
// state.current_calculation_epoch, // get_current_epoch(state),
// ) // )
// return get_epoch_committee_count(len(current_active_validators) // return get_epoch_committee_count(len(current_active_validators)
func CurrentEpochCommitteeCount(state *pb.BeaconState) uint64 { func CurrentEpochCommitteeCount(state *pb.BeaconState) uint64 {
currActiveValidatorIndices := ActiveValidatorIndices( currActiveValidatorIndices := ActiveValidatorIndices(
state.ValidatorRegistry, state.CurrentShufflingEpoch) state.ValidatorRegistry, CurrentEpoch(state))
return EpochCommitteeCount(uint64(len(currActiveValidatorIndices))) return EpochCommitteeCount(uint64(len(currActiveValidatorIndices)))
} }
@ -96,12 +96,12 @@ func CurrentEpochCommitteeCount(state *pb.BeaconState) uint64 {
// """ // """
// previous_active_validators = get_active_validator_indices( // previous_active_validators = get_active_validator_indices(
// state.validator_registry, // state.validator_registry,
// state.previous_calculation_epoch, // state.previous_epoch,
// ) // )
// return get_epoch_committee_count(len(previous_active_validators)) // return get_epoch_committee_count(len(previous_active_validators))
func PrevEpochCommitteeCount(state *pb.BeaconState) uint64 { func PrevEpochCommitteeCount(state *pb.BeaconState) uint64 {
prevActiveValidatorIndices := ActiveValidatorIndices( prevActiveValidatorIndices := ActiveValidatorIndices(
state.ValidatorRegistry, state.PreviousShufflingEpoch) state.ValidatorRegistry, PrevEpoch(state))
return EpochCommitteeCount(uint64(len(prevActiveValidatorIndices))) return EpochCommitteeCount(uint64(len(prevActiveValidatorIndices)))
} }