mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-12 03:34:20 +00:00
add queue eligibility helper
This commit is contained in:
parent
6610aeea2f
commit
e117b58ae2
@ -601,6 +601,20 @@ def is_slashable_validator(validator: Validator, epoch: Epoch) -> bool:
|
||||
return (not validator.slashed) and (validator.activation_epoch <= epoch < validator.withdrawable_epoch)
|
||||
```
|
||||
|
||||
#### `is_eligible_for_activation_queue`
|
||||
|
||||
```python
|
||||
def is_eligible_for_activation_queue(validator: Validator) -> bool:
|
||||
"""
|
||||
Check if ``validator`` is eligible to be placed into the activation queue.
|
||||
"""
|
||||
return (
|
||||
validator.activation_eligibility_epoch == FAR_FUTURE_EPOCH
|
||||
and validator.effective_balance == MAX_EFFECTIVE_BALANCE
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
#### `is_eligible_for_activation`
|
||||
|
||||
```python
|
||||
@ -1317,10 +1331,7 @@ def process_rewards_and_penalties(state: BeaconState) -> None:
|
||||
def process_registry_updates(state: BeaconState) -> None:
|
||||
# Process activation eligibility and ejections
|
||||
for index, validator in enumerate(state.validators):
|
||||
if (
|
||||
validator.activation_eligibility_epoch == FAR_FUTURE_EPOCH
|
||||
and validator.effective_balance == MAX_EFFECTIVE_BALANCE
|
||||
):
|
||||
if is_eligible_for_activation_queue(validator):
|
||||
validator.activation_eligibility_epoch = get_current_epoch(state)
|
||||
|
||||
if is_active_validator(validator, get_current_epoch(state)) and validator.effective_balance <= EJECTION_BALANCE:
|
||||
|
Loading…
x
Reference in New Issue
Block a user