fix bug with deposit generation code
This commit is contained in:
parent
31d46247ce
commit
ff6863e689
|
@ -103,6 +103,7 @@ def prepare_state_and_get_random_deposits(spec, state, rng):
|
||||||
deposits = []
|
deposits = []
|
||||||
|
|
||||||
# First build deposit data leaves
|
# First build deposit data leaves
|
||||||
|
root = None
|
||||||
for i in range(num_deposits):
|
for i in range(num_deposits):
|
||||||
index = len(state.validators) + i
|
index = len(state.validators) + i
|
||||||
_, root, deposit_data_leaves = build_deposit(
|
_, root, deposit_data_leaves = build_deposit(
|
||||||
|
@ -115,6 +116,8 @@ def prepare_state_and_get_random_deposits(spec, state, rng):
|
||||||
signed=True,
|
signed=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if root:
|
||||||
|
# NOTE: if ``num_deposits == 0``, ``root`` is never assigned to
|
||||||
state.eth1_data.deposit_root = root
|
state.eth1_data.deposit_root = root
|
||||||
state.eth1_data.deposit_count += num_deposits
|
state.eth1_data.deposit_count += num_deposits
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue