You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reindex.py 1.0KB

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python2
  2. # Copyright (c) 2014-2015 The Bitcoin Core developers
  3. # Distributed under the MIT software license, see the accompanying
  4. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
  5. #
  6. # Test -reindex with CheckBlockIndex
  7. #
  8. from test_framework.test_framework import BitcoinTestFramework
  9. from test_framework.util import *
  10. import os.path
  11. class ReindexTest(BitcoinTestFramework):
  12. def setup_chain(self):
  13. print("Initializing test directory "+self.options.tmpdir)
  14. initialize_chain_clean(self.options.tmpdir, 1)
  15. def setup_network(self):
  16. self.nodes = []
  17. self.is_network_split = False
  18. self.nodes.append(start_node(0, self.options.tmpdir))
  19. def run_test(self):
  20. self.nodes[0].generate(3)
  21. stop_node(self.nodes[0], 0)
  22. wait_bitcoinds()
  23. self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug", "-reindex", "-checkblockindex=1"])
  24. assert_equal(self.nodes[0].getblockcount(), 3)
  25. print "Success"
  26. if __name__ == '__main__':
  27. ReindexTest().main()