aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-05-18 12:31:22 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-05-18 12:31:32 +0200
commit239d4198645434542b01916dae5eebc7a3a7bbcc (patch)
tree4295bff1175ca8844908a7537e527c117a434dd8 /qa/rpc-tests
parent8e8bebc040a936798472f82043d59a22e2a67928 (diff)
parentb4d24e142e25a21c78ab74146c3520f2259fd7c2 (diff)
Merge #7917: Optimize reindex
b4d24e1 Report reindexing progress in GUI (Pieter Wuille) d3d7547 Add -reindex-chainstate that does not rebuild block index (Pieter Wuille) fb8fad1 Optimize ActivateBestChain for long chains (Pieter Wuille) 316623f Switch reindexing to AcceptBlock in-loop and ActivateBestChain afterwards (Pieter Wuille) d253ec4 Make ProcessNewBlock dbp const and update comment (Pieter Wuille)
Diffstat (limited to 'qa/rpc-tests')
-rwxr-xr-xqa/rpc-tests/reindex.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/qa/rpc-tests/reindex.py b/qa/rpc-tests/reindex.py
index 39564b32ba..a3f4d6ea01 100755
--- a/qa/rpc-tests/reindex.py
+++ b/qa/rpc-tests/reindex.py
@@ -4,10 +4,11 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
-# Test -reindex with CheckBlockIndex
+# Test -reindex and -reindex-chainstate with CheckBlockIndex
#
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
+import time
class ReindexTest(BitcoinTestFramework):
@@ -20,13 +21,22 @@ class ReindexTest(BitcoinTestFramework):
self.is_network_split = False
self.nodes.append(start_node(0, self.options.tmpdir))
- def run_test(self):
+ def reindex(self, justchainstate=False):
self.nodes[0].generate(3)
+ blockcount = self.nodes[0].getblockcount()
stop_node(self.nodes[0], 0)
wait_bitcoinds()
- self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug", "-reindex", "-checkblockindex=1"])
- assert_equal(self.nodes[0].getblockcount(), 3)
+ self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug", "-reindex-chainstate" if justchainstate else "-reindex", "-checkblockindex=1"])
+ while self.nodes[0].getblockcount() < blockcount:
+ time.sleep(0.1)
+ assert_equal(self.nodes[0].getblockcount(), blockcount)
print("Success")
+ def run_test(self):
+ self.reindex(False)
+ self.reindex(True)
+ self.reindex(False)
+ self.reindex(True)
+
if __name__ == '__main__':
ReindexTest().main()