fix bug with deposit generation code

This commit is contained in:
Alex Stokes 2021-08-23 12:01:05 -07:00
parent 31d46247ce
commit ff6863e689
No known key found for this signature in database
GPG Key ID: 99B3D88FD6C55A69
1 changed files with 4 additions and 1 deletions

View File

@ -103,6 +103,7 @@ def prepare_state_and_get_random_deposits(spec, state, rng):
deposits = []
# First build deposit data leaves
root = None
for i in range(num_deposits):
index = len(state.validators) + i
_, root, deposit_data_leaves = build_deposit(
@ -115,6 +116,8 @@ def prepare_state_and_get_random_deposits(spec, state, rng):
signed=True,
)
if root:
# NOTE: if ``num_deposits == 0``, ``root`` is never assigned to
state.eth1_data.deposit_root = root
state.eth1_data.deposit_count += num_deposits