Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_dbcrash.py
Show All 25 Lines | - for each mined block: | ||||
- check that utxo matches node3 using gettxoutsetinfo""" | - check that utxo matches node3 using gettxoutsetinfo""" | ||||
import errno | import errno | ||||
import http.client | import http.client | ||||
import random | import random | ||||
import time | import time | ||||
from test_framework.blocktools import create_confirmed_utxos | from test_framework.blocktools import create_confirmed_utxos | ||||
from test_framework.cdefs import DEFAULT_MAX_BLOCK_SIZE | |||||
from test_framework.messages import ( | from test_framework.messages import ( | ||||
COIN, | COIN, | ||||
COutPoint, | COutPoint, | ||||
CTransaction, | CTransaction, | ||||
CTxIn, | CTxIn, | ||||
CTxOut, | CTxOut, | ||||
ToHex, | ToHex, | ||||
) | ) | ||||
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 | # Need a bit of extra time for the nodes to start up for this test | ||||
self.rpc_timeout = 90 | self.rpc_timeout = 180 | ||||
# 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"] | # and non-standard txs (e.g. txs with "dust" outputs) | ||||
self.node3_args = [ | |||||
"-blockmaxsize={}".format(DEFAULT_MAX_BLOCK_SIZE), "-acceptnonstdtxn"] | |||||
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): | ||||
self.add_nodes(self.num_nodes, extra_args=self.extra_args) | self.add_nodes(self.num_nodes, extra_args=self.extra_args) | ||||
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 227 Lines • Show Last 20 Lines |