From d3095ac35a8891afc891458211130170d5a8a12e Mon Sep 17 00:00:00 2001 From: rkrux Date: Fri, 21 Feb 2025 16:30:09 +0530 Subject: [PATCH 1/2] contrib: update `dumptxoutset` command in utxo_to_sqlite doc Running the `dumptxoutset` command without a `type` parameter leads to the following error. Update the tool documentation to make it easier to follow. `Invalid snapshot type "" specified. Please specify "rollback" or "latest"` --- contrib/utxo-tools/utxo_to_sqlite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/utxo-tools/utxo_to_sqlite.py b/contrib/utxo-tools/utxo_to_sqlite.py index d53adadede8..20d834095cd 100755 --- a/contrib/utxo-tools/utxo_to_sqlite.py +++ b/contrib/utxo-tools/utxo_to_sqlite.py @@ -5,7 +5,7 @@ """Tool to convert a compact-serialized UTXO set to a SQLite3 database. The input UTXO set can be generated by Bitcoin Core with the `dumptxoutset` RPC: -$ bitcoin-cli dumptxoutset ~/utxos.dat +$ bitcoin-cli dumptxoutset ~/utxos.dat latest The created database contains a table `utxos` with the following schema: (txid TEXT, vout INT, value INT, coinbase INT, height INT, scriptpubkey TEXT) From e747ed989ebb7b9650ba1478d583f7f507e1083f Mon Sep 17 00:00:00 2001 From: rkrux Date: Fri, 21 Feb 2025 16:45:40 +0530 Subject: [PATCH 2/2] contrib: fix read metadata related comment The utxo snapshot metadata doesn't seem to contain any block height as per the CPP code and no such value is read few lines down by the tool code as well. Related CPP code: bitcoin/bitcoin/blob/28.x/src/node/utxo_snapshot.h#L60-L66 --- contrib/utxo-tools/utxo_to_sqlite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/utxo-tools/utxo_to_sqlite.py b/contrib/utxo-tools/utxo_to_sqlite.py index 20d834095cd..4758fe39aaa 100755 --- a/contrib/utxo-tools/utxo_to_sqlite.py +++ b/contrib/utxo-tools/utxo_to_sqlite.py @@ -126,7 +126,7 @@ def main(): con = sqlite3.connect(args.outfile) con.execute("CREATE TABLE utxos(txid TEXT, vout INT, value INT, coinbase INT, height INT, scriptpubkey TEXT)") - # read metadata (magic bytes, version, network magic, block height, block hash, UTXO count) + # read metadata (magic bytes, version, network magic, block hash, UTXO count) f = open(args.infile, 'rb') magic_bytes = f.read(5) version = int.from_bytes(f.read(2), 'little')