Fix Bug in process_pending_balance_deposits

This commit is contained in:
Mark Mackey 2024-03-19 13:31:55 -05:00
parent cf70df25d9
commit f6359f9afb
1 changed files with 14 additions and 8 deletions

View File

@ -533,17 +533,23 @@ def process_registry_updates(state: BeaconState) -> None:
```python ```python
def process_pending_balance_deposits(state: BeaconState) -> None: def process_pending_balance_deposits(state: BeaconState) -> None:
state.deposit_balance_to_consume += get_activation_exit_churn_limit(state) available_for_processing = state.deposit_balance_to_consume + get_activation_exit_churn_limit(state)
next_pending_deposit_index = 0 processed_amount = 0
for pending_balance_deposit in state.pending_balance_deposits: next_deposit_index = 0
if state.deposit_balance_to_consume < pending_balance_deposit.amount:
for deposit in state.pending_balance_deposits:
if processed_amount + deposit.amount > available_for_processing:
break break
increase_balance(state, deposit.index, deposit.amount)
processed_amount += deposit.amount
next_deposit_index += 1
state.deposit_balance_to_consume -= pending_balance_deposit.amount state.pending_balance_deposits = state.pending_balance_deposits[next_deposit_index:]
increase_balance(state, pending_balance_deposit.index, pending_balance_deposit.amount)
next_pending_deposit_index += 1
state.pending_balance_deposits = state.pending_balance_deposits[next_pending_deposit_index:] if len(state.pending_balance_deposits) == 0:
state.deposit_balance_to_consume = 0
else:
state.deposit_balance_to_consume = available_for_processing - processed_amount
``` ```
#### New `process_pending_consolidations` #### New `process_pending_consolidations`