Fix remaining issues

This commit is contained in:
UdjinM6 2019-09-20 16:12:07 +03:00 committed by Pasta
parent 02328ae966
commit 4b579c77aa
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
4 changed files with 14 additions and 7 deletions

View File

@ -1751,10 +1751,10 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
delete deterministicMNManager; delete deterministicMNManager;
delete evoDb; delete evoDb;
evoDb = new CEvoDB(nEvoDbCache, false, fReindex || fReindexChainState); evoDb = new CEvoDB(nEvoDbCache, false, fReset || fReindexChainState);
deterministicMNManager = new CDeterministicMNManager(*evoDb); deterministicMNManager = new CDeterministicMNManager(*evoDb);
pblocktree = new CBlockTreeDB(nBlockTreeDBCache, false, fReset); pblocktree = new CBlockTreeDB(nBlockTreeDBCache, false, fReset);
llmq::InitLLMQSystem(*evoDb, &scheduler, false, fReindex || fReindexChainState); llmq::InitLLMQSystem(*evoDb, &scheduler, false, fReset || fReindexChainState);
if (fReset) { if (fReset) {
pblocktree->WriteReindexing(true); pblocktree->WriteReindexing(true);

View File

@ -26,6 +26,7 @@ from test_framework.util import (connect_nodes, sync_blocks, assert_equal, set_n
import collections import collections
import enum import enum
import itertools import itertools
import sys
Call = enum.Enum("Call", "single multi") Call = enum.Enum("Call", "single multi")
Data = enum.Enum("Data", "address pub priv") Data = enum.Enum("Data", "address pub priv")
@ -120,9 +121,9 @@ class ImportRescanTest(BitcoinTestFramework):
for i, import_node in enumerate(IMPORT_NODES, 2): for i, import_node in enumerate(IMPORT_NODES, 2):
if import_node.prune: if import_node.prune:
# txindex is enabled by default in Dash and needs to be disabled for import-rescan.py # txindex is enabled by default in Dash and needs to be disabled for import-rescan.py
extra_args[i] += ["-prune=1", "-txindex=0", "-reindex-chainstate"] extra_args[i] += ["-prune=1", "-txindex=0", "-reindex"]
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, extra_args) self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, extra_args, stderr=sys.stdout)
for i in range(1, self.num_nodes): for i in range(1, self.num_nodes):
connect_nodes(self.nodes[i], 0) connect_nodes(self.nodes[i], 0)

View File

@ -11,6 +11,7 @@ Two nodes. Node1 is under test. Node0 is providing transactions and generating b
- Stop node1, clear the datadir, move wallet file back into the datadir and restart node1. - Stop node1, clear the datadir, move wallet file back into the datadir and restart node1.
- connect node1 to node0. Verify that they sync and node1 receives its funds.""" - connect node1 to node0. Verify that they sync and node1 receives its funds."""
import shutil import shutil
import sys
from test_framework.test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import ( from test_framework.util import (
@ -26,6 +27,9 @@ class KeypoolRestoreTest(BitcoinTestFramework):
self.num_nodes = 2 self.num_nodes = 2
self.extra_args = [['-usehd=0'], ['-usehd=1', '-keypool=100', '-keypoolmin=20']] self.extra_args = [['-usehd=0'], ['-usehd=1', '-keypool=100', '-keypoolmin=20']]
def setup_network(self):
self.setup_nodes(stderr=sys.stdout)
def run_test(self): def run_test(self):
self.tmpdir = self.options.tmpdir self.tmpdir = self.options.tmpdir
self.nodes[0].generate(101) self.nodes[0].generate(101)
@ -35,7 +39,7 @@ class KeypoolRestoreTest(BitcoinTestFramework):
self.stop_node(1) self.stop_node(1)
shutil.copyfile(self.tmpdir + "/node1/regtest/wallet.dat", self.tmpdir + "/wallet.bak") shutil.copyfile(self.tmpdir + "/node1/regtest/wallet.dat", self.tmpdir + "/wallet.bak")
self.nodes[1] = self.start_node(1, self.tmpdir, self.extra_args[1]) self.nodes[1] = self.start_node(1, self.tmpdir, self.extra_args[1], stderr=sys.stdout)
connect_nodes_bi(self.nodes, 0, 1) connect_nodes_bi(self.nodes, 0, 1)
self.log.info("Generate keys for wallet") self.log.info("Generate keys for wallet")
@ -61,7 +65,7 @@ class KeypoolRestoreTest(BitcoinTestFramework):
self.log.info("Verify keypool is restored and balance is correct") self.log.info("Verify keypool is restored and balance is correct")
self.nodes[1] = self.start_node(1, self.tmpdir, self.extra_args[1]) self.nodes[1] = self.start_node(1, self.tmpdir, self.extra_args[1], stderr=sys.stdout)
connect_nodes_bi(self.nodes, 0, 1) connect_nodes_bi(self.nodes, 0, 1)
self.sync_all() self.sync_all()
@ -69,7 +73,7 @@ class KeypoolRestoreTest(BitcoinTestFramework):
assert_equal(self.nodes[1].listtransactions()[0]['category'], "receive") assert_equal(self.nodes[1].listtransactions()[0]['category'], "receive")
# Check that we have marked all keys up to the used keypool key as used # Check that we have marked all keys up to the used keypool key as used
assert_equal(self.nodes[1].validateaddress(self.nodes[1].getnewaddress())['hdkeypath'], "m/0'/0'/111'") assert_equal(self.nodes[1].validateaddress(self.nodes[1].getnewaddress())['hdkeypath'], "m/44'/1'/0'/0/111")
if __name__ == '__main__': if __name__ == '__main__':
KeypoolRestoreTest().main() KeypoolRestoreTest().main()

View File

@ -76,6 +76,8 @@ class WalletHDTest(BitcoinTestFramework):
# otherwise node1 would auto-recover all funds in flag the keypool keys as used # otherwise node1 would auto-recover all funds in flag the keypool keys as used
shutil.rmtree(tmpdir + "/node1/regtest/blocks") shutil.rmtree(tmpdir + "/node1/regtest/blocks")
shutil.rmtree(tmpdir + "/node1/regtest/chainstate") shutil.rmtree(tmpdir + "/node1/regtest/chainstate")
shutil.rmtree(tmpdir + "/node1/regtest/evodb")
shutil.rmtree(tmpdir + "/node1/regtest/llmq")
shutil.copyfile(tmpdir + "/hd.bak", tmpdir + "/node1/regtest/wallet.dat") shutil.copyfile(tmpdir + "/hd.bak", tmpdir + "/node1/regtest/wallet.dat")
self.nodes[1] = self.start_node(1, self.options.tmpdir, self.extra_args[1], stderr=sys.stdout) self.nodes[1] = self.start_node(1, self.options.tmpdir, self.extra_args[1], stderr=sys.stdout)