Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_pruning.py
Show All 33 Lines | |||||
def calc_usage(blockdir): | def calc_usage(blockdir): | ||||
return sum(os.path.getsize(blockdir+f) for f in os.listdir(blockdir) if os.path.isfile(os.path.join(blockdir, f))) / (1024. * 1024.) | return sum(os.path.getsize(blockdir+f) for f in os.listdir(blockdir) if os.path.isfile(os.path.join(blockdir, f))) / (1024. * 1024.) | ||||
class PruneTest(BitcoinTestFramework): | 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.rpc_timewait = 900 | |||||
# 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", | ||||
"-limitdescendantcount=100", "-limitdescendantsize=5000", | "-limitdescendantcount=100", "-limitdescendantsize=5000", | ||||
"-limitancestorcount=100", "-limitancestorsize=5000"] | "-limitancestorcount=100", "-limitancestorsize=5000"] | ||||
# 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) | ||||
Show All 17 Lines | def setup_network(self): | ||||
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[2], self.nodes[0]) | connect_nodes(self.nodes[2], self.nodes[0]) | ||||
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]) | ||||
sync_blocks(self.nodes[0:5]) | sync_blocks(self.nodes[0:5]) | ||||
def setup_nodes(self): | def setup_nodes(self): | ||||
self.add_nodes(self.num_nodes, self.extra_args, timewait=900) | self.add_nodes(self.num_nodes, self.extra_args) | ||||
self.start_nodes() | self.start_nodes() | ||||
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) | ||||
sync_blocks(self.nodes[0:2]) | 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 435 Lines • Show Last 20 Lines |