aboutsummaryrefslogtreecommitdiff
path: root/test/functional/pruning.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/pruning.py')
-rwxr-xr-xtest/functional/pruning.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/test/functional/pruning.py b/test/functional/pruning.py
index 0af91e0658..fe406e89ad 100755
--- a/test/functional/pruning.py
+++ b/test/functional/pruning.py
@@ -56,6 +56,10 @@ class PruneTest(BitcoinTestFramework):
connect_nodes(self.nodes[0], 4)
sync_blocks(self.nodes[0:5])
+ def setup_nodes(self):
+ self.add_nodes(self.num_nodes, self.options.tmpdir, self.extra_args, timewait=900)
+ self.start_nodes()
+
def create_big_chain(self):
# Start by creating some coinbases we can spend later
self.nodes[1].generate(200)
@@ -98,7 +102,7 @@ class PruneTest(BitcoinTestFramework):
# Node 2 stays connected, so it hears about the stale blocks and then reorg's when node0 reconnects
# Stopping node 0 also clears its mempool, so it doesn't have node1's transactions to accidentally mine
self.stop_node(0)
- self.nodes[0]=self.start_node(0, self.options.tmpdir, self.full_node_default_args, timewait=900)
+ self.start_node(0, extra_args=self.full_node_default_args)
# Mine 24 blocks in node 1
for i in range(24):
if j == 0:
@@ -126,7 +130,7 @@ class PruneTest(BitcoinTestFramework):
# Reboot node 1 to clear its mempool (hopefully make the invalidate faster)
# Lower the block max size so we don't keep mining all our big mempool transactions (from disconnected blocks)
self.stop_node(1)
- self.nodes[1] = self.start_node(1, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=5000", "-checkblocks=5", "-disablesafemode"], timewait=900)
+ self.start_node(1, extra_args=["-maxreceivebuffer=20000","-blockmaxsize=5000", "-checkblocks=5", "-disablesafemode"])
height = self.nodes[1].getblockcount()
self.log.info("Current block height: %d" % height)
@@ -149,7 +153,7 @@ class PruneTest(BitcoinTestFramework):
# Reboot node1 to clear those giant tx's from mempool
self.stop_node(1)
- self.nodes[1] = self.start_node(1, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=5000", "-checkblocks=5", "-disablesafemode"], timewait=900)
+ self.start_node(1, extra_args=["-maxreceivebuffer=20000","-blockmaxsize=5000", "-checkblocks=5", "-disablesafemode"])
self.log.info("Generating new longer chain of 300 more blocks")
self.nodes[1].generate(300)
@@ -227,13 +231,15 @@ class PruneTest(BitcoinTestFramework):
def manual_test(self, node_number, use_timestamp):
# at this point, node has 995 blocks and has not yet run in prune mode
- node = self.nodes[node_number] = self.start_node(node_number, self.options.tmpdir, timewait=900)
+ self.start_node(node_number)
+ node = self.nodes[node_number]
assert_equal(node.getblockcount(), 995)
assert_raises_jsonrpc(-1, "not in prune mode", node.pruneblockchain, 500)
- self.stop_node(node_number)
# now re-start in manual pruning mode
- node = self.nodes[node_number] = self.start_node(node_number, self.options.tmpdir, ["-prune=1"], timewait=900)
+ self.stop_node(node_number)
+ self.start_node(node_number, extra_args=["-prune=1"])
+ node = self.nodes[node_number]
assert_equal(node.getblockcount(), 995)
def height(index):
@@ -307,7 +313,7 @@ class PruneTest(BitcoinTestFramework):
# stop node, start back up with auto-prune at 550MB, make sure still runs
self.stop_node(node_number)
- self.nodes[node_number] = self.start_node(node_number, self.options.tmpdir, ["-prune=550"], timewait=900)
+ self.start_node(node_number, extra_args=["-prune=550"])
self.log.info("Success")
@@ -315,7 +321,7 @@ class PruneTest(BitcoinTestFramework):
# check that the pruning node's wallet is still in good shape
self.log.info("Stop and start pruning node to trigger wallet rescan")
self.stop_node(2)
- self.nodes[2] = self.start_node(2, self.options.tmpdir, ["-prune=550"])
+ self.start_node(2, extra_args=["-prune=550"])
self.log.info("Success")
# check that wallet loads successfully when restarting a pruned node after IBD.
@@ -325,7 +331,7 @@ class PruneTest(BitcoinTestFramework):
nds = [self.nodes[0], self.nodes[5]]
sync_blocks(nds, wait=5, timeout=300)
self.stop_node(5) #stop and start to trigger rescan
- self.nodes[5] = self.start_node(5, self.options.tmpdir, ["-prune=550"])
+ self.start_node(5, extra_args=["-prune=550"])
self.log.info("Success")
def run_test(self):