Skip to content

Commit 8fc196e

Browse files
authored
update block processing (#7079)
1 parent 5b7a8ba commit 8fc196e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

beacon_chain/spec/beaconstate.nim

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,12 +1498,19 @@ template get_expected_withdrawals_with_partial_count_aux*(
14981498

14991499
has_sufficient_effective_balance =
15001500
effective_balance_at_slot >= static(MIN_ACTIVATION_BALANCE.Gwei)
1501-
has_excess_balance = fetch_balance > static(MIN_ACTIVATION_BALANCE.Gwei)
1501+
total_withdrawn = block:
1502+
var res: Gwei
1503+
for w in withdrawals:
1504+
if w.validator_index == validator_index:
1505+
res += w.amount
1506+
res
1507+
balance = fetch_balance - total_withdrawn
1508+
has_excess_balance = balance > static(MIN_ACTIVATION_BALANCE.Gwei)
15021509
if validator.exit_epoch == FAR_FUTURE_EPOCH and
15031510
has_sufficient_effective_balance and has_excess_balance:
15041511
let
15051512
withdrawable_balance = min(
1506-
fetch_balance - static(MIN_ACTIVATION_BALANCE.Gwei),
1513+
balance - static(MIN_ACTIVATION_BALANCE.Gwei),
15071514
withdrawal.amount)
15081515
var w = Withdrawal(
15091516
index: withdrawal_index,

0 commit comments

Comments
 (0)