Clarify use of `FAR_FUTURE_EPOCH` as a flag

This commit is contained in:
Justin 2019-02-21 22:34:11 +01:00 committed by GitHub
parent e25e87f003
commit 5f59aad00d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1955,7 +1955,7 @@ def update_validator_registry(state: BeaconState) -> None:
# Activate validators within the allowable balance churn # Activate validators within the allowable balance churn
balance_churn = 0 balance_churn = 0
for index, validator in enumerate(state.validator_registry): for index, validator in enumerate(state.validator_registry):
if validator.activation_epoch > get_delayed_activation_exit_epoch(current_epoch) and state.validator_balances[index] >= MAX_DEPOSIT_AMOUNT: if validator.activation_epoch == FAR_FUTURE_EPOCH and state.validator_balances[index] >= MAX_DEPOSIT_AMOUNT:
# Check the balance churn would be within the allowance # Check the balance churn would be within the allowance
balance_churn += get_effective_balance(state, index) balance_churn += get_effective_balance(state, index)
if balance_churn > max_balance_churn: if balance_churn > max_balance_churn:
@ -1967,7 +1967,7 @@ def update_validator_registry(state: BeaconState) -> None:
# Exit validators within the allowable balance churn # Exit validators within the allowable balance churn
balance_churn = 0 balance_churn = 0
for index, validator in enumerate(state.validator_registry): for index, validator in enumerate(state.validator_registry):
if validator.exit_epoch > get_delayed_activation_exit_epoch(current_epoch) and validator.initiated_exit: if validator.activation_epoch == FAR_FUTURE_EPOCH and validator.initiated_exit:
# Check the balance churn would be within the allowance # Check the balance churn would be within the allowance
balance_churn += get_effective_balance(state, index) balance_churn += get_effective_balance(state, index)
if balance_churn > max_balance_churn: if balance_churn > max_balance_churn:
@ -2029,7 +2029,7 @@ def process_exit_queue(state: BeaconState) -> None:
def eligible(index): def eligible(index):
validator = state.validator_registry[index] validator = state.validator_registry[index]
# Filter out dequeued validators # Filter out dequeued validators
if validator.withdrawable_epoch < FAR_FUTURE_EPOCH: if validator.withdrawable_epoch != FAR_FUTURE_EPOCH:
return False return False
# Dequeue if the minimum amount of time has passed # Dequeue if the minimum amount of time has passed
else: else: