From 329bafa6e20db6bace8b181fe356e11ab0f18a30 Mon Sep 17 00:00:00 2001 From: Potuz Date: Thu, 3 Nov 2022 14:58:55 -0300 Subject: [PATCH] dapplion's suggestions --- specs/capella/beacon-chain.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/specs/capella/beacon-chain.md b/specs/capella/beacon-chain.md index 7409c9726..42fbf85bd 100644 --- a/specs/capella/beacon-chain.md +++ b/specs/capella/beacon-chain.md @@ -287,28 +287,26 @@ def get_expected_withdrawals(state: BeaconState) -> Sequence[Withdrawal]: epoch = get_current_epoch(state) withdrawal_index = state.next_withdrawal_index index = state.last_withdrawal_validator_index - ret: List[Withdrawal] = [] - for i in range(len(state.validators)): + withdrawals: List[Withdrawal] = [] + for _ in range(len(state.validators)): index = ValidatorIndex((index + 1) % len(state.validators)) val = state.validators[index] balance = state.balances[index] if is_fully_withdrawable_validator(val, balance, epoch): - withdrawal = Withdrawal( + withdrawals.append(Withdrawal( index=withdrawal_index, validator_index=index, address=ExecutionAddress(val.withdrawal_credentials[12:]), amount=balance, - ) - ret.append(withdrawal) + )) withdrawal_index = WithdrawalIndex(withdrawal_index + 1) elif is_partially_withdrawable_validator(val, balance): - withdrawal = Withdrawal( + withdrawals.append(Withdrawal( index=withdrawal_index, validator_index=index, address=ExecutionAddress(val.withdrawal_credentials[12:]), amount=balance - MAX_EFFECTIVE_BALANCE, - ) - ret.append(withdrawal) + )) withdrawal_index = WithdrawalIndex(withdrawal_index + 1) if len(ret) == MAX_WITHDRAWALS_PER_PAYLOAD: break