mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
Merge bitcoin/bitcoin#31925: contrib: update utxo_to_sqlite
tool documentation and comment
e747ed989e
contrib: fix read metadata related comment (rkrux)d3095ac35a
contrib: update `dumptxoutset` command in utxo_to_sqlite doc (rkrux) Pull request description: I noticed couple discrepancies in the documentation and comments of `utxo_to_sqlite` tool while using it, this PR fixes them. More details in the commit messages. ACKs for top commit: theStack: lgtm ACKe747ed989e
Tree-SHA512: c5dab25d97c50a203ba008acfc5c93baf20cf24261a5a5127bdacc41eeeeae1c9d7b129710c2997e9fd1536ec000186e7f6395efc0188e1111b47868b7d9745a
This commit is contained in:
commit
279ab20bbd
1 changed files with 2 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
||||||
"""Tool to convert a compact-serialized UTXO set to a SQLite3 database.
|
"""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:
|
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:
|
The created database contains a table `utxos` with the following schema:
|
||||||
(txid TEXT, vout INT, value INT, coinbase INT, height INT, scriptpubkey TEXT)
|
(txid TEXT, vout INT, value INT, coinbase INT, height INT, scriptpubkey TEXT)
|
||||||
|
@ -126,7 +126,7 @@ def main():
|
||||||
con = sqlite3.connect(args.outfile)
|
con = sqlite3.connect(args.outfile)
|
||||||
con.execute("CREATE TABLE utxos(txid TEXT, vout INT, value INT, coinbase INT, height INT, scriptpubkey TEXT)")
|
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')
|
f = open(args.infile, 'rb')
|
||||||
magic_bytes = f.read(5)
|
magic_bytes = f.read(5)
|
||||||
version = int.from_bytes(f.read(2), 'little')
|
version = int.from_bytes(f.read(2), 'little')
|
||||||
|
|
Loading…
Add table
Reference in a new issue