Minor modification to reduce lines of code (#607)

This commit is contained in:
Paul Hauner 2019-02-12 22:06:26 +11:00 committed by Justin
parent 98902d12e3
commit 3ea0c27be0
1 changed files with 2 additions and 4 deletions

View File

@ -2030,12 +2030,10 @@ def process_penalties_and_exits(state: BeaconState) -> None:
eligible_indices = filter(eligible, all_indices)
# Sort in order of exit epoch, and validators that exit within the same epoch exit in order of validator index
sorted_indices = sorted(eligible_indices, key=lambda index: state.validator_registry[index].exit_epoch)
withdrawn_so_far = 0
for index in sorted_indices:
prepare_validator_for_withdrawal(state, index)
withdrawn_so_far += 1
for withdrawn_so_far, index in enumerate(sorted_indices):
if withdrawn_so_far >= MAX_WITHDRAWALS_PER_EPOCH:
break
prepare_validator_for_withdrawal(state, index)
```
#### Final updates