Changeset View
Changeset View
Standalone View
Standalone View
test/functional/blockchain.py
Show All 28 Lines | from test_framework.util import ( | ||||
assert_raises, | assert_raises, | ||||
assert_raises_jsonrpc, | assert_raises_jsonrpc, | ||||
assert_is_hex_string, | assert_is_hex_string, | ||||
assert_is_hash_string, | assert_is_hash_string, | ||||
) | ) | ||||
class BlockchainTest(BitcoinTestFramework): | class BlockchainTest(BitcoinTestFramework): | ||||
def __init__(self): | def set_test_params(self): | ||||
super().__init__() | |||||
self.setup_clean_chain = False | |||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
self.extra_args = [['-stopatheight=207']] | self.extra_args = [['-stopatheight=207']] | ||||
def run_test(self): | def run_test(self): | ||||
self._test_getchaintxstats() | self._test_getchaintxstats() | ||||
self._test_gettxoutsetinfo() | self._test_gettxoutsetinfo() | ||||
self._test_getblockheader() | self._test_getblockheader() | ||||
self._test_getdifficulty() | self._test_getdifficulty() | ||||
▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | def _test_stopatheight(self): | ||||
assert_raises(subprocess.TimeoutExpired, | assert_raises(subprocess.TimeoutExpired, | ||||
lambda: self.nodes[0].process.wait(timeout=3)) | lambda: self.nodes[0].process.wait(timeout=3)) | ||||
try: | try: | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
except (ConnectionError, http.client.BadStatusLine): | except (ConnectionError, http.client.BadStatusLine): | ||||
pass # The node already shut down before response | pass # The node already shut down before response | ||||
self.log.debug('Node should stop at this height...') | self.log.debug('Node should stop at this height...') | ||||
self.nodes[0].process.wait(timeout=BITCOIND_PROC_WAIT_TIMEOUT) | self.nodes[0].process.wait(timeout=BITCOIND_PROC_WAIT_TIMEOUT) | ||||
self.nodes[0] = self.start_node(0, self.options.tmpdir) | self.start_node(0) | ||||
assert_equal(self.nodes[0].getblockcount(), 207) | assert_equal(self.nodes[0].getblockcount(), 207) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
BlockchainTest().main() | BlockchainTest().main() |