Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_dbcrash.py
Show First 20 Lines • Show All 286 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
"Invalidating block at height {}".format(random_height)) | "Invalidating block at height {}".format(random_height)) | ||||
self.nodes[3].invalidateblock( | self.nodes[3].invalidateblock( | ||||
self.nodes[3].getblockhash(random_height)) | self.nodes[3].getblockhash(random_height)) | ||||
# Now generate new blocks until we pass the old tip height | # Now generate new blocks until we pass the old tip height | ||||
self.log.debug("Mining longer tip") | self.log.debug("Mining longer tip") | ||||
block_hashes = [] | block_hashes = [] | ||||
while current_height + 1 > self.nodes[3].getblockcount(): | while current_height + 1 > self.nodes[3].getblockcount(): | ||||
block_hashes.extend(self.nodes[3].generate( | block_hashes.extend(self.nodes[3].generatetoaddress( | ||||
min(10, current_height + 1 - self.nodes[3].getblockcount()))) | nblocks=min(10, current_height + 1 - | ||||
self.log.debug( | self.nodes[3].getblockcount()), | ||||
"Syncing {} new blocks...".format(len(block_hashes))) | # new address to avoid mining a block that has just been | ||||
# invalidated | |||||
address=self.nodes[3].getnewaddress(), | |||||
)) | |||||
self.log.debug("Syncing %d new blocks...", len(block_hashes)) | |||||
self.sync_node3blocks(block_hashes) | self.sync_node3blocks(block_hashes) | ||||
utxo_list = self.nodes[3].listunspent() | utxo_list = self.nodes[3].listunspent() | ||||
self.log.debug("Node3 utxo count: {}".format(len(utxo_list))) | self.log.debug("Node3 utxo count: {}".format(len(utxo_list))) | ||||
# Check that the utxo hashes agree with node3 | # Check that the utxo hashes agree with node3 | ||||
# Useful side effect: each utxo cache gets flushed here, so that we | # Useful side effect: each utxo cache gets flushed here, so that we | ||||
# won't get crashes on shutdown at the end of the test. | # won't get crashes on shutdown at the end of the test. | ||||
self.verify_utxo_hash() | self.verify_utxo_hash() | ||||
Show All 20 Lines |