-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Use median-time-past for input sequence checks rather than block… #239
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@m-kus. Kindly review so i can proceed with the scripts. |
scripts/data/generate_data.py
Outdated
@@ -173,37 +185,41 @@ def fetch_block(block_hash: str, fast: bool): | |||
) | |||
|
|||
block["data"] = { | |||
tx["txid"]: resolve_transaction(tx, previous_outputs) | |||
tx["txid"]: resolve_transaction( | |||
tx, previous_outputs, block["mediantime"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so you need to do some more changes, because here you should provide current_chain_state["median_time_past"]
You need to implement an "apply" function for chain state that would produce next_chain_state from the current_chain_state. Then you provide chain_state to the fetch_block function to get MTP.
As a bonus you'll be able to get rid of fetch_chain_state function because now you are computing it from the previous ones.
scripts/data/generate_data.py
Outdated
@@ -71,6 +77,7 @@ def fetch_chain_state_fast(block_height: int): | |||
head["epoch_start_time"] = 1231006505 | |||
else: | |||
head["epoch_start_time"] = int(data["epoch_start_time"]) | |||
head["median_time_past"] = compute_median_time_past(head["prev_timestamps"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
median_time is already in the data
(check if it is correct)
… time