Refactor `exit_validator`
This commit is contained in:
parent
bdd6868736
commit
bcb0b8bf87
|
@ -1316,12 +1316,13 @@ def exit_validator(state: BeaconState, index: ValidatorIndex) -> None:
|
||||||
Note that this function mutates ``state``.
|
Note that this function mutates ``state``.
|
||||||
"""
|
"""
|
||||||
validator = state.validator_registry[index]
|
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
|
# The following updates only occur if not previous exited
|
||||||
if validator.exit_epoch <= get_delayed_activation_exit_epoch(get_current_epoch(state)):
|
if validator.exit_epoch <= delayed_activation_exit_epoch:
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
validator.exit_epoch = get_delayed_activation_exit_epoch(get_current_epoch(state))
|
validator.exit_epoch = delayed_activation_exit_epoch
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `slash_validator`
|
#### `slash_validator`
|
||||||
|
|
Loading…
Reference in New Issue