Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_dbcrash.py
Show First 20 Lines • Show All 233 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# Start by creating a lot of utxos on node3 | # Start by creating a lot of utxos on node3 | ||||
initial_height = self.nodes[3].getblockcount() | initial_height = self.nodes[3].getblockcount() | ||||
utxo_list = create_confirmed_utxos(self.nodes[3], 5000) | utxo_list = create_confirmed_utxos(self.nodes[3], 5000) | ||||
self.log.info("Prepped {} utxo entries".format(len(utxo_list))) | self.log.info("Prepped {} utxo entries".format(len(utxo_list))) | ||||
# Sync these blocks with the other nodes | # Sync these blocks with the other nodes | ||||
block_hashes_to_sync = [] | block_hashes_to_sync = [] | ||||
for height in range(initial_height + 1, self.nodes[3].getblockcount() + 1): | for height in range(initial_height + 1, | ||||
self.nodes[3].getblockcount() + 1): | |||||
block_hashes_to_sync.append(self.nodes[3].getblockhash(height)) | block_hashes_to_sync.append(self.nodes[3].getblockhash(height)) | ||||
self.log.debug("Syncing {} blocks with other nodes".format( | self.log.debug("Syncing {} blocks with other nodes".format( | ||||
len(block_hashes_to_sync))) | len(block_hashes_to_sync))) | ||||
# Syncing the blocks could cause nodes to crash, so the test begins here. | # Syncing the blocks could cause nodes to crash, so the test begins | ||||
# here. | |||||
self.sync_node3blocks(block_hashes_to_sync) | self.sync_node3blocks(block_hashes_to_sync) | ||||
starting_tip_height = self.nodes[3].getblockcount() | starting_tip_height = self.nodes[3].getblockcount() | ||||
# Main test loop: | # Main test loop: | ||||
# each time through the loop, generate a bunch of transactions, | # each time through the loop, generate a bunch of transactions, | ||||
# and then either mine a single new block on the tip, or some-sized reorg. | # and then either mine a single new block on the tip, or some-sized | ||||
# reorg. | |||||
for i in range(40): | for i in range(40): | ||||
self.log.info( | self.log.info( | ||||
"Iteration {}, generating 2500 transactions {}".format( | "Iteration {}, generating 2500 transactions {}".format( | ||||
i, self.restart_counts)) | i, self.restart_counts)) | ||||
# Generate a bunch of small-ish transactions | # Generate a bunch of small-ish transactions | ||||
self.generate_small_transactions(self.nodes[3], 2500, utxo_list) | self.generate_small_transactions(self.nodes[3], 2500, utxo_list) | ||||
# Pick a random block between current tip, and starting tip | # Pick a random block between current tip, and starting tip | ||||
current_height = self.nodes[3].getblockcount() | current_height = self.nodes[3].getblockcount() | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |