Fix `get_genesis_beacon_state` and minor refactoring

This commit is contained in:
Hsiao-Wei Wang 2019-04-07 01:24:50 +11:00
parent 63412d9b9e
commit 5ea5746fdd
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
1 changed files with 9 additions and 8 deletions

View File

@ -1565,7 +1565,7 @@ def get_genesis_beacon_state(genesis_validator_deposits: List[Deposit],
process_deposit(state, deposit)
# Process genesis activations
for validator_index in state.validator_registry:
for validator_index in range(len(state.validator_registry)):
if get_effective_balance(state, validator_index) >= MAX_DEPOSIT_AMOUNT:
activate_validator(state, validator_index, is_genesis=True)
@ -2019,7 +2019,8 @@ Run the following function:
```python
def update_registry(state: BeaconState) -> None:
activation_queue = sorted([validator for _, validator in enumerate(validators) if
activation_queue = sorted([
validator for validator in state.validator_registry if
validator.activation_epoch == FAR_FUTURE_EPOCH and
validator.activation_eligibility_epoch != FAR_FUTURE_EPOCH and
validator.activation_eligibility_epoch > state.finalized_epoch