mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-16 08:22:46 +00:00
test: add test for utxo-to-sqlite conversion using named pipe
This commit is contained in:
parent
2e8072edbe
commit
61a5460d0d
@ -4,7 +4,8 @@
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""Test utxo-to-sqlite conversion tool"""
|
||||
from itertools import product
|
||||
import os.path
|
||||
import os
|
||||
import platform
|
||||
try:
|
||||
import sqlite3
|
||||
except ImportError:
|
||||
@ -135,6 +136,19 @@ class UtxoToSqliteTest(BitcoinTestFramework):
|
||||
assert_equal(muhash_sqlite, muhash_compact_serialized)
|
||||
self.log.info('')
|
||||
|
||||
if platform.system() != "Windows": # FIFOs are not available on Windows
|
||||
self.log.info('Convert UTXO set directly (without intermediate dump) via named pipe')
|
||||
fifo_filename = os.path.join(self.options.tmpdir, "utxos.fifo")
|
||||
os.mkfifo(fifo_filename)
|
||||
output_direct_filename = os.path.join(self.options.tmpdir, "utxos_direct.sqlite")
|
||||
p = subprocess.Popen([sys.executable, utxo_to_sqlite_path, fifo_filename, output_direct_filename],
|
||||
stderr=subprocess.STDOUT)
|
||||
node.dumptxoutset(fifo_filename, "latest")
|
||||
p.wait(timeout=10)
|
||||
muhash_direct_sqlite = calculate_muhash_from_sqlite_utxos(output_direct_filename, "hex", "hex")
|
||||
assert_equal(muhash_sqlite, muhash_direct_sqlite)
|
||||
os.remove(fifo_filename)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
UtxoToSqliteTest(__file__).main()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user