Skip to content

Commit

Permalink
Fix script: next chain state
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kus committed Oct 30, 2024
1 parent 8e37a5e commit 6ba2234
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/data/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,10 @@ def next_chain_state(current_state: dict, new_block: dict) -> dict:
"""Computes the next chain state given the current state and a new block."""
next_state = new_block.copy()

# Update prev_timestamps
next_state["prev_timestamps"] = current_state["prev_timestamps"][1:] + [
new_block["time"]
]
# We need to recalculate the prev_timestamps field given the previous chain state
# and all the blocks we applied to it
prev_timestamps = current_state["prev_timestamps"] + [new_block["time"]]
next_state["prev_timestamps"] = prev_timestamps[-11:]

# Update epoch start time
if new_block["height"] % 2016 == 0:
Expand Down

0 comments on commit 6ba2234

Please sign in to comment.