|
|
@ -98,7 +98,7 @@ class PruneTest(BitcoinTestFramework): |
|
|
|
# Node 2 stays connected, so it hears about the stale blocks and then reorg's when node0 reconnects |
|
|
|
# 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 |
|
|
|
# Stopping node 0 also clears its mempool, so it doesn't have node1's transactions to accidentally mine |
|
|
|
self.stop_node(0) |
|
|
|
self.stop_node(0) |
|
|
|
self.nodes[0]=start_node(0, self.options.tmpdir, self.full_node_default_args, timewait=900) |
|
|
|
self.nodes[0]=self.start_node(0, self.options.tmpdir, self.full_node_default_args, timewait=900) |
|
|
|
# Mine 24 blocks in node 1 |
|
|
|
# Mine 24 blocks in node 1 |
|
|
|
for i in range(24): |
|
|
|
for i in range(24): |
|
|
|
if j == 0: |
|
|
|
if j == 0: |
|
|
@ -126,7 +126,7 @@ class PruneTest(BitcoinTestFramework): |
|
|
|
# Reboot node 1 to clear its mempool (hopefully make the invalidate faster) |
|
|
|
# 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) |
|
|
|
# Lower the block max size so we don't keep mining all our big mempool transactions (from disconnected blocks) |
|
|
|
self.stop_node(1) |
|
|
|
self.stop_node(1) |
|
|
|
self.nodes[1]=start_node(1, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=5000", "-checkblocks=5", "-disablesafemode"], timewait=900) |
|
|
|
self.nodes[1] = self.start_node(1, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=5000", "-checkblocks=5", "-disablesafemode"], timewait=900) |
|
|
|
|
|
|
|
|
|
|
|
height = self.nodes[1].getblockcount() |
|
|
|
height = self.nodes[1].getblockcount() |
|
|
|
self.log.info("Current block height: %d" % height) |
|
|
|
self.log.info("Current block height: %d" % height) |
|
|
@ -149,7 +149,7 @@ class PruneTest(BitcoinTestFramework): |
|
|
|
|
|
|
|
|
|
|
|
# Reboot node1 to clear those giant tx's from mempool |
|
|
|
# Reboot node1 to clear those giant tx's from mempool |
|
|
|
self.stop_node(1) |
|
|
|
self.stop_node(1) |
|
|
|
self.nodes[1]=start_node(1, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=5000", "-checkblocks=5", "-disablesafemode"], timewait=900) |
|
|
|
self.nodes[1] = self.start_node(1, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=5000", "-checkblocks=5", "-disablesafemode"], timewait=900) |
|
|
|
|
|
|
|
|
|
|
|
self.log.info("Generating new longer chain of 300 more blocks") |
|
|
|
self.log.info("Generating new longer chain of 300 more blocks") |
|
|
|
self.nodes[1].generate(300) |
|
|
|
self.nodes[1].generate(300) |
|
|
@ -227,13 +227,13 @@ class PruneTest(BitcoinTestFramework): |
|
|
|
|
|
|
|
|
|
|
|
def manual_test(self, node_number, use_timestamp): |
|
|
|
def manual_test(self, node_number, use_timestamp): |
|
|
|
# at this point, node has 995 blocks and has not yet run in prune mode |
|
|
|
# at this point, node has 995 blocks and has not yet run in prune mode |
|
|
|
node = self.nodes[node_number] = start_node(node_number, self.options.tmpdir, timewait=900) |
|
|
|
node = self.nodes[node_number] = self.start_node(node_number, self.options.tmpdir, timewait=900) |
|
|
|
assert_equal(node.getblockcount(), 995) |
|
|
|
assert_equal(node.getblockcount(), 995) |
|
|
|
assert_raises_jsonrpc(-1, "not in prune mode", node.pruneblockchain, 500) |
|
|
|
assert_raises_jsonrpc(-1, "not in prune mode", node.pruneblockchain, 500) |
|
|
|
self.stop_node(node_number) |
|
|
|
self.stop_node(node_number) |
|
|
|
|
|
|
|
|
|
|
|
# now re-start in manual pruning mode |
|
|
|
# now re-start in manual pruning mode |
|
|
|
node = self.nodes[node_number] = start_node(node_number, self.options.tmpdir, ["-prune=1"], timewait=900) |
|
|
|
node = self.nodes[node_number] = self.start_node(node_number, self.options.tmpdir, ["-prune=1"], timewait=900) |
|
|
|
assert_equal(node.getblockcount(), 995) |
|
|
|
assert_equal(node.getblockcount(), 995) |
|
|
|
|
|
|
|
|
|
|
|
def height(index): |
|
|
|
def height(index): |
|
|
@ -307,7 +307,7 @@ class PruneTest(BitcoinTestFramework): |
|
|
|
|
|
|
|
|
|
|
|
# stop node, start back up with auto-prune at 550MB, make sure still runs |
|
|
|
# stop node, start back up with auto-prune at 550MB, make sure still runs |
|
|
|
self.stop_node(node_number) |
|
|
|
self.stop_node(node_number) |
|
|
|
self.nodes[node_number] = start_node(node_number, self.options.tmpdir, ["-prune=550"], timewait=900) |
|
|
|
self.nodes[node_number] = self.start_node(node_number, self.options.tmpdir, ["-prune=550"], timewait=900) |
|
|
|
|
|
|
|
|
|
|
|
self.log.info("Success") |
|
|
|
self.log.info("Success") |
|
|
|
|
|
|
|
|
|
|
@ -315,7 +315,7 @@ class PruneTest(BitcoinTestFramework): |
|
|
|
# check that the pruning node's wallet is still in good shape |
|
|
|
# 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.log.info("Stop and start pruning node to trigger wallet rescan") |
|
|
|
self.stop_node(2) |
|
|
|
self.stop_node(2) |
|
|
|
start_node(2, self.options.tmpdir, ["-prune=550"]) |
|
|
|
self.start_node(2, self.options.tmpdir, ["-prune=550"]) |
|
|
|
self.log.info("Success") |
|
|
|
self.log.info("Success") |
|
|
|
|
|
|
|
|
|
|
|
# check that wallet loads loads successfully when restarting a pruned node after IBD. |
|
|
|
# check that wallet loads loads successfully when restarting a pruned node after IBD. |
|
|
@ -325,7 +325,7 @@ class PruneTest(BitcoinTestFramework): |
|
|
|
nds = [self.nodes[0], self.nodes[5]] |
|
|
|
nds = [self.nodes[0], self.nodes[5]] |
|
|
|
sync_blocks(nds, wait=5, timeout=300) |
|
|
|
sync_blocks(nds, wait=5, timeout=300) |
|
|
|
self.stop_node(5) #stop and start to trigger rescan |
|
|
|
self.stop_node(5) #stop and start to trigger rescan |
|
|
|
start_node(5, self.options.tmpdir, ["-prune=550"]) |
|
|
|
self.start_node(5, self.options.tmpdir, ["-prune=550"]) |
|
|
|
self.log.info("Success") |
|
|
|
self.log.info("Success") |
|
|
|
|
|
|
|
|
|
|
|
def run_test(self): |
|
|
|
def run_test(self): |
|
|
|