Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify exit_validator #801

Merged
merged 2 commits into from
Mar 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 4 additions & 7 deletions specs/core/0_beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -1364,17 +1364,14 @@ def initiate_validator_exit(state: BeaconState, index: ValidatorIndex) -> None:
```python
def exit_validator(state: BeaconState, index: ValidatorIndex) -> None:
"""
Exit the validator of the given ``index``.
Exit the validator with the given ``index``.
Note that this function mutates ``state``.
"""
validator = state.validator_registry[index]
delayed_activation_exit_epoch = get_delayed_activation_exit_epoch(get_current_epoch(state))

# The following updates only occur if not previous exited
if validator.exit_epoch <= delayed_activation_exit_epoch:
return
else:
validator.exit_epoch = delayed_activation_exit_epoch
# Update validator exit epoch if not previously exited
if validator.exit_epoch == FAR_FUTURE_EPOCH:
validator.exit_epoch = get_delayed_activation_exit_epoch(get_current_epoch(state))
```

#### `slash_validator`
Expand Down