diff --git a/scripts/data/generate_data.py b/scripts/data/generate_data.py index a33775df..72eec4b8 100755 --- a/scripts/data/generate_data.py +++ b/scripts/data/generate_data.py @@ -266,48 +266,24 @@ def generate_data( elif mode == "full": block = fetch_block(next_block_hash) - for tx in block["data"]: - for idx, output in enumerate(tx["outputs"]): - outpoint = (tx["txid"], idx) - utxo_set[outpoint] = output - - output["cached"] = False - for tx in block["data"]: for tx_input in tx["inputs"]: outpoint = ( tx_input["previous_output"]["txid"], tx_input["previous_output"]["vout"], ) - if outpoint in utxo_set: tx_input["previous_output"]["cached"] = True utxo_set[outpoint]["cached"] = True + for idx, output in enumerate(tx["outputs"]): + outpoint = (tx["txid"], idx) + utxo_set[outpoint] = output else: raise NotImplementedError(mode) next_block_hash = block["nextblockhash"] blocks.append(block) - for block in blocks: - for tx in block["data"]: - for idx, output in enumerate(tx["outputs"]): - outpoint = (tx["txid"], idx) - if outpoint in utxo_set: - tx["outputs"][idx]["cached"] = utxo_set[outpoint].get( - "cached", False - ) - - for tx_input in tx["inputs"]: - outpoint = ( - tx_input["previous_output"]["txid"], - tx_input["previous_output"]["vout"], - ) - if outpoint in utxo_set: - tx_input["previous_output"]["cached"] = utxo_set[outpoint].get( - "cached", False - ) - block_formatter = ( format_block if mode == "light" else format_block_with_transactions )