Skip to content

Commit

Permalink
update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
fishonamos committed Oct 7, 2024
1 parent ee41e1f commit ee74190
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions scripts/data/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
}

Expand All @@ -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,
}

Expand All @@ -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": [
Expand Down
11 changes: 5 additions & 6 deletions scripts/data/generate_utreexo_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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"],
)
Expand All @@ -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,
):
Expand All @@ -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,
)
Expand All @@ -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")

0 comments on commit ee74190

Please sign in to comment.