Changeset View
Changeset View
Standalone View
Standalone View
test/functional/dbcrash.py
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | def set_test_params(self): | ||||
# Set different crash ratios and cache sizes. Note that not all of | # Set different crash ratios and cache sizes. Note that not all of | ||||
# -dbcache goes to pcoinsTip. | # -dbcache goes to pcoinsTip. | ||||
self.node0_args = ["-dbcrashratio=8", "-dbcache=4"] + self.base_args | self.node0_args = ["-dbcrashratio=8", "-dbcache=4"] + self.base_args | ||||
self.node1_args = ["-dbcrashratio=16", "-dbcache=8"] + self.base_args | self.node1_args = ["-dbcrashratio=16", "-dbcache=8"] + self.base_args | ||||
self.node2_args = ["-dbcrashratio=24", "-dbcache=16"] + self.base_args | self.node2_args = ["-dbcrashratio=24", "-dbcache=16"] + self.base_args | ||||
# Node3 is a normal node with default args, except will mine full blocks | # Node3 is a normal node with default args, except will mine full blocks | ||||
self.node3_args = ["-blockmaxsize=32000000", | self.node3_args = ["-blockmaxsize=32000000"] | ||||
"-deprecatedrpc=signrawtransaction"] | |||||
self.extra_args = [self.node0_args, self.node1_args, | self.extra_args = [self.node0_args, self.node1_args, | ||||
self.node2_args, self.node3_args] | self.node2_args, self.node3_args] | ||||
def setup_network(self): | def setup_network(self): | ||||
# Need a bit of extra time for the nodes to start up for this test | # Need a bit of extra time for the nodes to start up for this test | ||||
self.add_nodes(self.num_nodes, extra_args=self.extra_args, timewait=90) | self.add_nodes(self.num_nodes, extra_args=self.extra_args, timewait=90) | ||||
self.start_nodes() | self.start_nodes() | ||||
# Leave them unconnected, we'll use submitblock directly in this test | # Leave them unconnected, we'll use submitblock directly in this test | ||||
▲ Show 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | def generate_small_transactions(self, node, count, utxo_list): | ||||
# Sanity check -- if we chose inputs that are too small, skip | # Sanity check -- if we chose inputs that are too small, skip | ||||
continue | continue | ||||
for i in range(3): | for i in range(3): | ||||
tx.vout.append( | tx.vout.append( | ||||
CTxOut(output_amount, hex_str_to_bytes(utxo['scriptPubKey']))) | CTxOut(output_amount, hex_str_to_bytes(utxo['scriptPubKey']))) | ||||
# Sign and send the transaction to get into the mempool | # Sign and send the transaction to get into the mempool | ||||
tx_signed_hex = node.signrawtransaction(ToHex(tx))['hex'] | tx_signed_hex = node.signrawtransactionwithwallet(ToHex(tx))['hex'] | ||||
node.sendrawtransaction(tx_signed_hex) | node.sendrawtransaction(tx_signed_hex) | ||||
num_transactions += 1 | num_transactions += 1 | ||||
def run_test(self): | def run_test(self): | ||||
# Track test coverage statistics | # Track test coverage statistics | ||||
self.restart_counts = [0, 0, 0] # Track the restarts for nodes 0-2 | self.restart_counts = [0, 0, 0] # Track the restarts for nodes 0-2 | ||||
self.crashed_on_restart = 0 # Track count of crashes during recovery | self.crashed_on_restart = 0 # Track count of crashes during recovery | ||||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |