mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-20 14:28:22 +00:00
Make process_withdrawals slightly cleaner (equivalent functionality) (#3761)
This commit is contained in:
parent
92aeafeab9
commit
7ab2bbe89b
@ -379,10 +379,9 @@ def get_expected_withdrawals(state: BeaconState) -> Sequence[Withdrawal]:
|
|||||||
```python
|
```python
|
||||||
def process_withdrawals(state: BeaconState, payload: ExecutionPayload) -> None:
|
def process_withdrawals(state: BeaconState, payload: ExecutionPayload) -> None:
|
||||||
expected_withdrawals = get_expected_withdrawals(state)
|
expected_withdrawals = get_expected_withdrawals(state)
|
||||||
assert len(payload.withdrawals) == len(expected_withdrawals)
|
assert payload.withdrawals == expected_withdrawals
|
||||||
|
|
||||||
for expected_withdrawal, withdrawal in zip(expected_withdrawals, payload.withdrawals):
|
for withdrawal in expected_withdrawals:
|
||||||
assert withdrawal == expected_withdrawal
|
|
||||||
decrease_balance(state, withdrawal.validator_index, withdrawal.amount)
|
decrease_balance(state, withdrawal.validator_index, withdrawal.amount)
|
||||||
|
|
||||||
# Update the next withdrawal index if this block contained withdrawals
|
# Update the next withdrawal index if this block contained withdrawals
|
||||||
|
Loading…
x
Reference in New Issue
Block a user