Changeset View
Changeset View
Standalone View
Standalone View
test/functional/blockchain.py
Show First 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | def _test_getnetworkhashps(self): | ||||
assert abs(hashes_per_second * 300 - 1) < 0.0001 | assert abs(hashes_per_second * 300 - 1) < 0.0001 | ||||
def _test_stopatheight(self): | def _test_stopatheight(self): | ||||
assert_equal(self.nodes[0].getblockcount(), 200) | assert_equal(self.nodes[0].getblockcount(), 200) | ||||
self.nodes[0].generate(6) | self.nodes[0].generate(6) | ||||
assert_equal(self.nodes[0].getblockcount(), 206) | assert_equal(self.nodes[0].getblockcount(), 206) | ||||
self.log.debug('Node should not stop at this height') | self.log.debug('Node should not stop at this height') | ||||
assert_raises(subprocess.TimeoutExpired, | assert_raises(subprocess.TimeoutExpired, | ||||
lambda: self.bitcoind_processes[0].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.bitcoind_processes[0].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.nodes[0] = self.start_node(0, self.options.tmpdir) | ||||
assert_equal(self.nodes[0].getblockcount(), 207) | assert_equal(self.nodes[0].getblockcount(), 207) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
BlockchainTest().main() | BlockchainTest().main() |