mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
86a11a83a2
fa3f9a05660687bf4146e089050e944a1d6cbe3c test: Fix intermittent sync_blocks failures (MarcoFalke) Pull request description: Fixes #18872 Fixes #18737 Fixes #18801 See docstring for motivation and description ACKs for top commit: laanwj: Code review ACK fa3f9a05660687bf4146e089050e944a1d6cbe3c Tree-SHA512: acd52d386a6849f7ff1cb1a51a439dc3c76e0e3a4dd8d22030df0ebb09b44497c61c56331ff65724b695d82d86b0ebb24608f9e637008e5dacb7676b0c448889
38 lines
1.4 KiB
Python
Executable File
38 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2014-2016 The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
"""Test running dashd with -reindex and -reindex-chainstate options.
|
|
|
|
- Start a single node and generate 3 blocks.
|
|
- Stop the node and restart it with -reindex. Verify that the node has reindexed up to block 3.
|
|
- Stop the node and restart it with -reindex-chainstate. Verify that the node has reindexed up to block 3.
|
|
"""
|
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
|
from test_framework.util import assert_equal
|
|
|
|
|
|
class ReindexTest(BitcoinTestFramework):
|
|
def set_test_params(self):
|
|
self.setup_clean_chain = True
|
|
self.num_nodes = 1
|
|
|
|
def reindex(self, justchainstate=False):
|
|
self.nodes[0].generatetoaddress(3, self.nodes[0].get_deterministic_priv_key().address)
|
|
blockcount = self.nodes[0].getblockcount()
|
|
self.stop_nodes()
|
|
extra_args = [["-reindex-chainstate" if justchainstate else "-reindex"]]
|
|
self.start_nodes(extra_args)
|
|
assert_equal(self.nodes[0].getblockcount(), blockcount) # start_node is blocking on reindex
|
|
self.log.info("Success")
|
|
|
|
def run_test(self):
|
|
self.reindex(False)
|
|
self.reindex(True)
|
|
self.reindex(False)
|
|
self.reindex(True)
|
|
|
|
if __name__ == '__main__':
|
|
ReindexTest().main()
|