g11tech review
This commit is contained in:
parent
7e4d1696da
commit
a14479a70f
|
@ -288,8 +288,7 @@ def get_expected_withdrawals(state: BeaconState) -> Sequence[Withdrawal]:
|
||||||
withdrawal_index = state.next_withdrawal_index
|
withdrawal_index = state.next_withdrawal_index
|
||||||
index = ValidatorIndex((state.last_withdrawal_validator_index + 1) % len(state.validators))
|
index = ValidatorIndex((state.last_withdrawal_validator_index + 1) % len(state.validators))
|
||||||
ret: List[Withdrawal] = []
|
ret: List[Withdrawal] = []
|
||||||
probed = 0
|
for probed in range(len(state.validators))):
|
||||||
while (len(ret) < MAX_WITHDRAWALS_PER_PAYLOAD) and (probed < len(state.validators)):
|
|
||||||
val = state.validators[index]
|
val = state.validators[index]
|
||||||
balance = state.balances[index]
|
balance = state.balances[index]
|
||||||
if is_fully_withdrawable_validator(val, balance, epoch):
|
if is_fully_withdrawable_validator(val, balance, epoch):
|
||||||
|
@ -310,6 +309,8 @@ def get_expected_withdrawals(state: BeaconState) -> Sequence[Withdrawal]:
|
||||||
)
|
)
|
||||||
ret.append(withdrawal)
|
ret.append(withdrawal)
|
||||||
withdrawal_index = WithdrawalIndex(withdrawal_index + 1)
|
withdrawal_index = WithdrawalIndex(withdrawal_index + 1)
|
||||||
|
if len(ret) == MAX_WITHDRAWALS_PER_PAYLOAD:
|
||||||
|
break
|
||||||
probed += 1
|
probed += 1
|
||||||
index = ValidatorIndex((index + probed) % len(state.validators))
|
index = ValidatorIndex((index + probed) % len(state.validators))
|
||||||
return ret
|
return ret
|
||||||
|
|
Loading…
Reference in New Issue