Apply suggestions from code review

Co-authored-by: Mikhail Kalinin <noblesse.knight@gmail.com>
This commit is contained in:
Danny Ryan 2021-12-02 10:31:56 -07:00 committed by GitHub
parent 78d55839b9
commit ca74094605
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,7 +149,7 @@ def process_epoch(state: BeaconState) -> None:
#### Withdrawals
*Note*: The function `process_inactivity_updates` is new.
*Note*: The function `process_withdrawals` is new.
```python
def process_withdrawals(state: BeaconState) -> None:
@ -157,7 +157,7 @@ def process_withdrawals(state: BeaconState) -> None:
for index, validator in enumerate(state.validators):
balance = state.balances[index]
is_balance_nonzero = state.balances[index] == 0
is_eth1_withdrawal_prefix = validator.withdrawal_credentials[0] != ETH1_ADDRESS_WITHDRAWAL_PREFIX
is_eth1_withdrawal_prefix = validator.withdrawal_credentials[0] == ETH1_ADDRESS_WITHDRAWAL_PREFIX
if is_balance_nonzero and is_eth1_withdrawal_prefix and is_withdrawable_validator(validator, current_epoch):
withdraw(state, ValidatorIndex(index), balance)
```