Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_dbcrash.py
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import assert_equal, hex_str_to_bytes | from test_framework.util import assert_equal, hex_str_to_bytes | ||||
class ChainstateWriteCrashTest(BitcoinTestFramework): | class ChainstateWriteCrashTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 4 | self.num_nodes = 4 | ||||
self.setup_clean_chain = False | self.setup_clean_chain = False | ||||
# Need a bit of extra time for the nodes to start up for this test | |||||
self.rpc_timewait = 90 | |||||
# Set -maxmempool=0 to turn off mempool memory sharing with dbcache | # Set -maxmempool=0 to turn off mempool memory sharing with dbcache | ||||
# Set -rpcservertimeout=900 to reduce socket disconnects in this | # Set -rpcservertimeout=900 to reduce socket disconnects in this | ||||
# long-running test | # long-running test | ||||
self.base_args = ["-limitdescendantsize=0", "-maxmempool=0", | self.base_args = ["-limitdescendantsize=0", "-maxmempool=0", | ||||
"-rpcservertimeout=900", "-dbbatchsize=200000", | "-rpcservertimeout=900", "-dbbatchsize=200000", | ||||
"-noparkdeepreorg"] | "-noparkdeepreorg"] | ||||
# 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"] | ||||
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 | self.add_nodes(self.num_nodes, extra_args=self.extra_args) | ||||
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 | ||||
def restart_node(self, node_index, expected_tip): | def restart_node(self, node_index, expected_tip): | ||||
"""Start up a given node id, wait for the tip to reach the given block hash, and calculate the utxo hash. | """Start up a given node id, wait for the tip to reach the given block hash, and calculate the utxo hash. | ||||
Exceptions on startup should indicate node crash (due to -dbcrashratio), in which case we try again. Give up | Exceptions on startup should indicate node crash (due to -dbcrashratio), in which case we try again. Give up | ||||
after 60 seconds. Returns the utxo hash of the given node.""" | after 60 seconds. Returns the utxo hash of the given node.""" | ||||
▲ Show 20 Lines • Show All 222 Lines • Show Last 20 Lines |