|
|
|
@ -7,7 +7,11 @@
@@ -7,7 +7,11 @@
|
|
|
|
|
# Test -reindex and -reindex-chainstate with CheckBlockIndex |
|
|
|
|
# |
|
|
|
|
from test_framework.test_framework import BitcoinTestFramework |
|
|
|
|
from test_framework.util import * |
|
|
|
|
from test_framework.util import ( |
|
|
|
|
start_nodes, |
|
|
|
|
stop_nodes, |
|
|
|
|
assert_equal, |
|
|
|
|
) |
|
|
|
|
import time |
|
|
|
|
|
|
|
|
|
class ReindexTest(BitcoinTestFramework): |
|
|
|
@ -18,16 +22,14 @@ class ReindexTest(BitcoinTestFramework):
@@ -18,16 +22,14 @@ class ReindexTest(BitcoinTestFramework):
|
|
|
|
|
self.num_nodes = 1 |
|
|
|
|
|
|
|
|
|
def setup_network(self): |
|
|
|
|
self.nodes = [] |
|
|
|
|
self.is_network_split = False |
|
|
|
|
self.nodes.append(start_node(0, self.options.tmpdir)) |
|
|
|
|
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir) |
|
|
|
|
|
|
|
|
|
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-chainstate" if justchainstate else "-reindex", "-checkblockindex=1"]) |
|
|
|
|
stop_nodes(self.nodes) |
|
|
|
|
extra_args = [["-debug", "-reindex-chainstate" if justchainstate else "-reindex", "-checkblockindex=1"]] |
|
|
|
|
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args) |
|
|
|
|
while self.nodes[0].getblockcount() < blockcount: |
|
|
|
|
time.sleep(0.1) |
|
|
|
|
assert_equal(self.nodes[0].getblockcount(), blockcount) |
|
|
|
|