Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_pruning.py
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | class PruneTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.num_nodes = 6 | self.num_nodes = 6 | ||||
self.supports_cli = False | self.supports_cli = False | ||||
# Create nodes 0 and 1 to mine. | # Create nodes 0 and 1 to mine. | ||||
# Create node 2 to test pruning. | # Create node 2 to test pruning. | ||||
self.full_node_default_args = ["-maxreceivebuffer=20000", "-blockmaxsize=999000", | self.full_node_default_args = ["-maxreceivebuffer=20000", "-blockmaxsize=999000", | ||||
"-checkblocks=5", "-noparkdeepreorg", "-maxreorgdepth=-1", | "-checkblocks=5", "-noparkdeepreorg", "-maxreorgdepth=-1"] | ||||
"-wallet="] | |||||
# Create nodes 3 and 4 to test manual pruning (they will be re-started with manual pruning later) | # Create nodes 3 and 4 to test manual pruning (they will be re-started with manual pruning later) | ||||
# Create nodes 5 to test wallet in prune mode, but do not connect | # Create nodes 5 to test wallet in prune mode, but do not connect | ||||
self.extra_args = [self.full_node_default_args, | self.extra_args = [self.full_node_default_args, | ||||
self.full_node_default_args, | self.full_node_default_args, | ||||
["-wallet=", "-maxreceivebuffer=20000", "-prune=550", | ["-maxreceivebuffer=20000", "-prune=550", | ||||
"-noparkdeepreorg", "-maxreorgdepth=-1"], | "-noparkdeepreorg", "-maxreorgdepth=-1"], | ||||
["-wallet=", "-maxreceivebuffer=20000", "-blockmaxsize=999000", | ["-maxreceivebuffer=20000", "-blockmaxsize=999000", | ||||
"-noparkdeepreorg", "-maxreorgdepth=-1"], | "-noparkdeepreorg", "-maxreorgdepth=-1"], | ||||
["-wallet=", "-maxreceivebuffer=20000", "-blockmaxsize=999000", | ["-maxreceivebuffer=20000", "-blockmaxsize=999000", | ||||
"-noparkdeepreorg", "-maxreorgdepth=-1"], | "-noparkdeepreorg", "-maxreorgdepth=-1"], | ||||
["-wallet=", "-prune=550"]] | ["-prune=550"]] | ||||
self.rpc_timeout = 120 | self.rpc_timeout = 120 | ||||
def skip_test_if_missing_module(self): | def skip_test_if_missing_module(self): | ||||
self.skip_if_no_wallet() | self.skip_if_no_wallet() | ||||
def setup_network(self): | def setup_network(self): | ||||
self.setup_nodes() | self.setup_nodes() | ||||
self.prunedir = os.path.join( | self.prunedir = os.path.join( | ||||
self.nodes[2].datadir, self.chain, 'blocks', '') | self.nodes[2].datadir, self.chain, 'blocks', '') | ||||
connect_nodes(self.nodes[0], self.nodes[1]) | connect_nodes(self.nodes[0], self.nodes[1]) | ||||
connect_nodes(self.nodes[1], self.nodes[2]) | connect_nodes(self.nodes[1], self.nodes[2]) | ||||
connect_nodes(self.nodes[0], self.nodes[2]) | connect_nodes(self.nodes[0], self.nodes[2]) | ||||
connect_nodes(self.nodes[0], self.nodes[3]) | connect_nodes(self.nodes[0], self.nodes[3]) | ||||
connect_nodes(self.nodes[0], self.nodes[4]) | connect_nodes(self.nodes[0], self.nodes[4]) | ||||
self.sync_blocks(self.nodes[0:5]) | self.sync_blocks(self.nodes[0:5]) | ||||
def setup_nodes(self): | def setup_nodes(self): | ||||
self.add_nodes(self.num_nodes, self.extra_args) | self.add_nodes(self.num_nodes, self.extra_args) | ||||
self.start_nodes() | self.start_nodes() | ||||
for n in self.nodes: | self.import_deterministic_coinbase_privkeys() | ||||
n.importprivkey( | |||||
privkey=n.get_deterministic_priv_key().key, | |||||
label='coinbase', | |||||
rescan=False) | |||||
def create_big_chain(self): | def create_big_chain(self): | ||||
# Start by creating some coinbases we can spend later | # Start by creating some coinbases we can spend later | ||||
self.nodes[1].generate(200) | self.nodes[1].generate(200) | ||||
self.sync_blocks(self.nodes[0:2]) | self.sync_blocks(self.nodes[0:2]) | ||||
self.nodes[0].generate(150) | self.nodes[0].generate(150) | ||||
# Then mine enough full blocks to create more than 550MiB of data | # Then mine enough full blocks to create more than 550MiB of data | ||||
▲ Show 20 Lines • Show All 384 Lines • Show Last 20 Lines |