From ee74190547a0c0b0a301004ca28414abcf801592 Mon Sep 17 00:00:00 2001 From: Fishon Amos Date: Mon, 7 Oct 2024 09:14:44 +0100 Subject: [PATCH] update scripts --- scripts/data/generate_data.py | 6 +++--- scripts/data/generate_utreexo_data.py | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/scripts/data/generate_data.py b/scripts/data/generate_data.py index 1dcd405..3df2677 100755 --- a/scripts/data/generate_data.py +++ b/scripts/data/generate_data.py @@ -225,7 +225,7 @@ def format_outpoint(previous_output): }, "block_hash": previous_output["block_hash"], "block_height": int(previous_output["block_height"]), - "block_time": int(previous_output["block_time"]), + "median_time_past": int(previous_output["median_time_past"]), "is_coinbase": previous_output["is_coinbase"], } @@ -242,7 +242,7 @@ def resolve_outpoint(input: dict): "data": format_output(tx["vout"][input["vout"]]), "block_hash": tx["blockhash"], "block_height": block["height"], - "block_time": block["time"], + "median_time_past": block["time"], "is_coinbase": tx["vin"][0].get("coinbase") is not None, } @@ -258,7 +258,7 @@ def format_coinbase_input(input: dict): "data": {"value": 0, "pk_script": "0x", "cached": False}, "block_hash": "0" * 64, "block_height": 0, - "block_time": 0, + "median_time_past": 0, "is_coinbase": False, }, "witness": [ diff --git a/scripts/data/generate_utreexo_data.py b/scripts/data/generate_utreexo_data.py index 5b97d6f..241ba25 100644 --- a/scripts/data/generate_utreexo_data.py +++ b/scripts/data/generate_utreexo_data.py @@ -114,11 +114,10 @@ def __repr__(self): vout={self.vout}\n\ tx_out={self.data}\n\ block_height={self.block_height}\n\ - block_time={self.block_time}\n\ + median_time_past={self.median_time_past}\n\ block_hash={self.block_hash}\n\ is_coinbase={self.is_coinbase})" - class UtreexoData: def __init__(self) -> None: self.utreexo = Utreexo() @@ -175,7 +174,7 @@ def handle_txin(self, inputs: list) -> list: cached=outpoint["data"]["cached"], ), block_height=outpoint["block_height"], - block_time=outpoint["block_time"], + median_time_past=outpoint["median_time_past"], block_hash=outpoint["block_hash"], is_coinbase=outpoint["is_coinbase"], ) @@ -193,7 +192,7 @@ def handle_txout( outputs: list, block_hash: str, block_height: int, - block_time: int, + median_time_past: int, txid: str, is_coinbase: bool, ): @@ -211,7 +210,7 @@ def handle_txout( cached=output["cached"], ), block_height=block_height, - block_time=block_time, + median_time_past=median_time_past, block_hash=block_hash, is_coinbase=is_coinbase, ) @@ -228,4 +227,4 @@ def format_root_node(node) -> str: def format_node(node) -> int: - return int.from_bytes(bytes.fromhex(node.val[2:]), "big") + return int.from_bytes(bytes.fromhex(node.val[2:]), "big") \ No newline at end of file