Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_loadblock.py
Show All 10 Lines | |||||
""" | """ | ||||
import os | import os | ||||
import subprocess | import subprocess | ||||
import sys | import sys | ||||
import tempfile | import tempfile | ||||
import urllib | import urllib | ||||
from test_framework.test_framework import ( | from test_framework.test_framework import BitcoinTestFramework | ||||
BitcoinTestFramework, | from test_framework.util import assert_equal | ||||
) | |||||
from test_framework.util import assert_equal, wait_until | |||||
class LoadblockTest(BitcoinTestFramework): | class LoadblockTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.num_nodes = 2 | self.num_nodes = 2 | ||||
self.supports_cli = False | self.supports_cli = False | ||||
Show All 40 Lines | def run_test(self): | ||||
self.log.info("Run linearization of block data") | self.log.info("Run linearization of block data") | ||||
linearize_data_file = os.path.join(linearize_dir, "linearize-data.py") | linearize_data_file = os.path.join(linearize_dir, "linearize-data.py") | ||||
subprocess.run([sys.executable, linearize_data_file, cfg_file], | subprocess.run([sys.executable, linearize_data_file, cfg_file], | ||||
check=True) | check=True) | ||||
self.log.info("Restart second, unsynced node with bootstrap file") | self.log.info("Restart second, unsynced node with bootstrap file") | ||||
self.stop_node(1) | self.stop_node(1) | ||||
self.start_node(1, ["-loadblock=" + bootstrap_file]) | self.start_node(1, ["-loadblock=" + bootstrap_file]) | ||||
wait_until(lambda: self.nodes[1].getblockcount() == 100) | # start_node is blocking on all block files being imported | ||||
assert_equal(self.nodes[1].getblockcount(), 100) | |||||
assert_equal(self.nodes[1].getblockchaininfo()['blocks'], 100) | assert_equal(self.nodes[1].getblockchaininfo()['blocks'], 100) | ||||
assert_equal( | assert_equal( | ||||
self.nodes[0].getbestblockhash(), | self.nodes[0].getbestblockhash(), | ||||
self.nodes[1].getbestblockhash()) | self.nodes[1].getbestblockhash()) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
LoadblockTest().main() | LoadblockTest().main() |