From f6ea1a9f03d9e623d940d66090adce2bc8888176 Mon Sep 17 00:00:00 2001 From: pasta Date: Wed, 2 Nov 2022 20:50:40 -0500 Subject: [PATCH 1/3] revert: merge bitcoin#20186 (Make -wallet setting not create wallets) reverts f27ef79e4c18c34311649dc1f626d2b0e198218f --- doc/release-notes/release-notes-20186.md | 16 -------- src/wallet/init.cpp | 2 +- src/wallet/load.cpp | 13 +------ test/functional/feature_config_args.py | 8 +++- test/functional/rpc_scantxoutset.py | 3 +- .../test_framework/test_framework.py | 11 ++---- test/functional/tool_wallet.py | 3 +- test/functional/wallet_backup.py | 16 +++----- test/functional/wallet_dump.py | 8 ++-- test/functional/wallet_multiwallet.py | 38 ++++++------------- 10 files changed, 34 insertions(+), 84 deletions(-) delete mode 100644 doc/release-notes/release-notes-20186.md diff --git a/doc/release-notes/release-notes-20186.md b/doc/release-notes/release-notes-20186.md deleted file mode 100644 index f20ae08200..0000000000 --- a/doc/release-notes/release-notes-20186.md +++ /dev/null @@ -1,16 +0,0 @@ -Wallet ------- - -### Automatic wallet creation removed - -Dash Core will no longer automatically create new wallets on startup. It will -load existing wallets specified by `-wallet` options on the command line or in -`dash.conf` or `settings.json` files. And by default it will also load a -top-level unnamed ("") wallet. However, if specified wallets don't exist, -Dash Core will now just log warnings instead of creating new wallets with -new keys and addresses like previous releases did. - -New wallets can be created through the GUI (which has a more prominent create -wallet option), through the `dash-cli createwallet` or `dash-wallet -create` commands, or the `createwallet` RPC. - diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 9cd9c97bdf..636b3efe22 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -58,7 +58,7 @@ void WalletInit::AddWalletOptions(ArgsManager& argsman) const " (1 = start from wallet creation time, 2 = start from genesis block)", ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); argsman.AddArg("-spendzeroconfchange", strprintf("Spend unconfirmed change when sending transactions (default: %u)", DEFAULT_SPEND_ZEROCONF_CHANGE), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); argsman.AddArg("-upgradewallet", "Upgrade wallet to latest format on startup", ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); - argsman.AddArg("-wallet=", "Specify wallet path to load at startup. Can be used multiple times to load multiple wallets. Path is to a directory containing wallet data and log files. If the path is not absolute, it is interpreted relative to . This only loads existing wallets and does not create new ones. For backwards compatibility this also accepts names of existing top-level data files in .", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::WALLET); + argsman.AddArg("-wallet=", "Specify wallet database path. Can be specified multiple times to load multiple wallets. Path is interpreted relative to if it is not absolute, and will be created if it does not exist (as a directory containing a wallet.dat file and log files). For backwards compatibility this will also accept names of existing data files in .)", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::WALLET); argsman.AddArg("-walletbackupsdir=", "Specify full path to directory for automatic wallet backups (must exist)", ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); argsman.AddArg("-walletbroadcast", strprintf("Make the wallet broadcast transactions (default: %u)", DEFAULT_WALLETBROADCAST), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); argsman.AddArg("-walletdir=", "Specify directory to hold wallets (default: /wallets if it exists, otherwise )", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::WALLET); diff --git a/src/wallet/load.cpp b/src/wallet/load.cpp index 43edd4867f..e95e7a3b16 100644 --- a/src/wallet/load.cpp +++ b/src/wallet/load.cpp @@ -74,16 +74,11 @@ bool VerifyWallets(interfaces::Chain& chain) DatabaseOptions options; DatabaseStatus status; - options.require_existing = true; options.verify = true; bilingual_str error_string; if (!MakeWalletDatabase(wallet_file, options, status, error_string)) { - if (status == DatabaseStatus::FAILED_NOT_FOUND) { - chain.initWarning(Untranslated(strprintf("Skipping -wallet path that doesn't exist. %s\n", error_string.original))); - } else { - chain.initError(error_string); - return false; - } + chain.initError(error_string); + return false; } } @@ -96,14 +91,10 @@ bool LoadWallets(interfaces::Chain& chain) for (const std::string& name : gArgs.GetArgs("-wallet")) { DatabaseOptions options; DatabaseStatus status; - options.require_existing = true; options.verify = false; // No need to verify, assuming verified earlier in VerifyWallets() bilingual_str error_string; std::vector warnings; std::unique_ptr database = MakeWalletDatabase(name, options, status, error_string); - if (!database && status == DatabaseStatus::FAILED_NOT_FOUND) { - continue; - } std::shared_ptr pwallet = database ? CWallet::Create(chain, name, std::move(database), options.create_flags, error_string, warnings) : nullptr; if (!warnings.empty()) chain.initWarning(Join(warnings, Untranslated("\n"))); if (!pwallet) { diff --git a/test/functional/feature_config_args.py b/test/functional/feature_config_args.py index 57cbdbd52b..cfe15803a0 100755 --- a/test/functional/feature_config_args.py +++ b/test/functional/feature_config_args.py @@ -148,15 +148,19 @@ class ConfArgsTest(BitcoinTestFramework): # Create the directory and ensure the config file now works os.mkdir(new_data_dir) # Temporarily disabled, because this test would access the user's home dir (~/.bitcoin) - self.start_node(0, ['-conf='+conf_file]) + self.start_node(0, ['-conf='+conf_file, '-wallet=w1']) self.stop_node(0) assert os.path.exists(os.path.join(new_data_dir, self.chain, 'blocks')) + if self.is_wallet_compiled(): + assert os.path.exists(os.path.join(new_data_dir, self.chain, 'wallets', 'w1')) # Ensure command line argument overrides datadir in conf os.mkdir(new_data_dir_2) self.nodes[0].datadir = new_data_dir_2 - self.start_node(0, ['-datadir='+new_data_dir_2, '-conf='+conf_file]) + self.start_node(0, ['-datadir='+new_data_dir_2, '-conf='+conf_file, '-wallet=w2']) assert os.path.exists(os.path.join(new_data_dir_2, self.chain, 'blocks')) + if self.is_wallet_compiled(): + assert os.path.exists(os.path.join(new_data_dir_2, self.chain, 'wallets', 'w2')) if __name__ == '__main__': diff --git a/test/functional/rpc_scantxoutset.py b/test/functional/rpc_scantxoutset.py index 5a87d2b056..56fb033489 100755 --- a/test/functional/rpc_scantxoutset.py +++ b/test/functional/rpc_scantxoutset.py @@ -55,8 +55,7 @@ class ScantxoutsetTest(BitcoinTestFramework): self.log.info("Stop node, remove wallet, mine again some blocks...") self.stop_node(0) shutil.rmtree(os.path.join(self.nodes[0].datadir, self.chain, 'wallets')) - self.start_node(0, ['-nowallet']) - self.import_deterministic_coinbase_privkeys() + self.start_node(0) self.nodes[0].generate(110) scan = self.nodes[0].scantxoutset("start", []) diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 60cd28afa1..6c639cf154 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -128,7 +128,6 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): # are not imported. self.wallet_names = None self.set_test_params() - assert self.wallet_names is None or len(self.wallet_names) <= self.num_nodes if self.options.timeout_factor == 0 : self.options.timeout_factor = 99999 self.rpc_timeout = int(self.rpc_timeout * self.options.timeout_factor) # optionally, increase timeout by a factor @@ -414,13 +413,9 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): assert_equal(chain_info["initialblockdownload"], False) def import_deterministic_coinbase_privkeys(self): - for i in range(len(self.nodes)): - self.init_wallet(i) - - def init_wallet(self, i): - wallet_name = self.default_wallet_name if self.wallet_names is None else self.wallet_names[i] if i < len(self.wallet_names) else False - if wallet_name is not False: - n = self.nodes[i] + wallet_names = [self.default_wallet_name] * len(self.nodes) if self.wallet_names is None else self.wallet_names + assert len(wallet_names) <= len(self.nodes) + for wallet_name, n in zip(wallet_names, self.nodes): if wallet_name is not None: n.createwallet(wallet_name=wallet_name, load_on_startup=True) n.importprivkey(privkey=n.get_deterministic_priv_key().key, label='coinbase') diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py index 9fc0b097cc..9feaf4e192 100755 --- a/test/functional/tool_wallet.py +++ b/test/functional/tool_wallet.py @@ -219,8 +219,7 @@ class ToolWalletTest(BitcoinTestFramework): def test_salvage(self): # TODO: Check salvage actually salvages and doesn't break things. https://github.com/bitcoin/bitcoin/issues/7463 self.log.info('Check salvage') - self.start_node(0) - self.nodes[0].createwallet("salvage") + self.start_node(0, ['-wallet=salvage']) self.stop_node(0) self.assert_tool_output('', '-wallet=salvage', 'salvage') diff --git a/test/functional/wallet_backup.py b/test/functional/wallet_backup.py index 914691ac43..93ae5a8608 100755 --- a/test/functional/wallet_backup.py +++ b/test/functional/wallet_backup.py @@ -87,10 +87,10 @@ class WalletBackupTest(BitcoinTestFramework): self.sync_blocks() # As above, this mirrors the original bash test. - def start_three(self, args=()): - self.start_node(0, self.extra_args[0] + list(args)) - self.start_node(1, self.extra_args[1] + list(args)) - self.start_node(2, self.extra_args[2] + list(args)) + def start_three(self): + self.start_node(0) + self.start_node(1) + self.start_node(2) self.connect_nodes(0, 3) self.connect_nodes(1, 3) self.connect_nodes(2, 3) @@ -106,11 +106,6 @@ class WalletBackupTest(BitcoinTestFramework): os.remove(os.path.join(self.nodes[1].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) os.remove(os.path.join(self.nodes[2].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) - def init_three(self): - self.init_wallet(0) - self.init_wallet(1) - self.init_wallet(2) - def run_test(self): self.log.info("Generating initial blockchain") self.nodes[0].generate(1) @@ -195,8 +190,7 @@ class WalletBackupTest(BitcoinTestFramework): shutil.rmtree(os.path.join(self.nodes[2].datadir, self.chain, 'evodb')) shutil.rmtree(os.path.join(self.nodes[2].datadir, self.chain, 'llmq')) - self.start_three(["-nowallet"]) - self.init_three() + self.start_three() assert_equal(self.nodes[0].getbalance(), 0) assert_equal(self.nodes[1].getbalance(), 0) diff --git a/test/functional/wallet_dump.py b/test/functional/wallet_dump.py index 9f24392ff9..098d375dff 100755 --- a/test/functional/wallet_dump.py +++ b/test/functional/wallet_dump.py @@ -79,7 +79,7 @@ def read_dump(file_name, addrs, script_addrs, hd_master_addr_old): class WalletDumpTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 - self.extra_args = [["-keypool=90", "-usehd=1"]] + self.extra_args = [["-keypool=90", "-usehd=1", "-wallet=dump"]] self.rpc_timeout = 120 def skip_test_if_missing_module(self): @@ -91,8 +91,6 @@ class WalletDumpTest(BitcoinTestFramework): self.start_nodes() def run_test(self): - self.nodes[0].createwallet("dump") - wallet_unenc_dump = os.path.join(self.nodes[0].datadir, "wallet.unencrypted.dump") wallet_enc_dump = os.path.join(self.nodes[0].datadir, "wallet.encrypted.dump") @@ -142,8 +140,8 @@ class WalletDumpTest(BitcoinTestFramework): assert_raises_rpc_error(-8, "already exists", lambda: self.nodes[0].dumpwallet(wallet_enc_dump)) # Restart node with new wallet, and test importwallet - self.restart_node(0) - self.nodes[0].createwallet("w2") + self.stop_node(0) + self.start_node(0, ['-wallet=w2']) # Make sure the address is not IsMine before import result = self.nodes[0].getaddressinfo(multisig_addr) diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py index 88cfbcdd64..d7d3fd7cbf 100755 --- a/test/functional/wallet_multiwallet.py +++ b/test/functional/wallet_multiwallet.py @@ -43,7 +43,6 @@ class MultiWalletTest(BitcoinTestFramework): self.setup_clean_chain = True self.num_nodes = 2 self.rpc_timeout = 120 - self.extra_args = [["-nowallet"], []] def skip_test_if_missing_module(self): self.skip_if_no_wallet() @@ -84,13 +83,10 @@ class MultiWalletTest(BitcoinTestFramework): os.rename(wallet_dir(self.default_wallet_name, self.wallet_data_filename), wallet_dir("w8")) # create another dummy wallet for use in testing backups later - self.start_node(0) - node.createwallet("empty") - node.createwallet(self.default_wallet_name) + self.start_node(0, ["-nowallet", "-wallet=" + self.default_wallet_name]) self.stop_nodes() empty_wallet = os.path.join(self.options.tmpdir, 'empty.dat') - os.rename(wallet_file("empty"), empty_wallet) - shutil.rmtree(wallet_dir("empty")) + os.rename(wallet_dir(self.default_wallet_name, self.wallet_data_filename), empty_wallet) # restart node with a mix of wallet names: # w1, w2, w3 - to verify new wallets created when non-existing paths specified @@ -103,24 +99,21 @@ class MultiWalletTest(BitcoinTestFramework): wallet_names = ['w1', 'w2', 'w3', 'w', 'sub/w5', os.path.join(self.options.tmpdir, 'extern/w6'), 'w7_symlink', 'w8', self.default_wallet_name] if os.name == 'nt': wallet_names.remove('w7_symlink') - self.start_node(0) - - for wallet_name in wallet_names[:-2]: - self.nodes[0].createwallet(wallet_name) - for wallet_name in wallet_names[-2:]: - self.nodes[0].loadwallet(wallet_name) + extra_args = ['-nowallet'] + ['-wallet={}'.format(n) for n in wallet_names] + self.start_node(0, extra_args) assert_equal(sorted(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), [self.default_wallet_name, os.path.join('sub', 'w5'), 'w', 'w1', 'w2', 'w3', 'w7', 'w7_symlink', 'w8']) assert_equal(set(node.listwallets()), set(wallet_names)) - # should raise rpc error if wallet path can't be created - assert_raises_rpc_error(-1, "boost::filesystem::create_directory:", self.nodes[0].createwallet, "w8/bad") - # check that all requested wallets were created self.stop_node(0) for wallet_name in wallet_names: assert_equal(os.path.isfile(wallet_file(wallet_name)), True) + # should not initialize if wallet path can't be created + exp_stderr = "boost::filesystem::create_directory:" + self.nodes[0].assert_start_raises_init_error(['-wallet=w8/bad'], exp_stderr, match=ErrorMatch.PARTIAL_REGEX) + self.nodes[0].assert_start_raises_init_error(['-walletdir=wallets'], 'Error: Specified -walletdir "wallets" does not exist') self.nodes[0].assert_start_raises_init_error(['-walletdir=wallets'], 'Error: Specified -walletdir "wallets" is a relative path', cwd=data_dir()) self.nodes[0].assert_start_raises_init_error(['-walletdir=debug.log'], 'Error: Specified -walletdir "debug.log" is not a directory', cwd=data_dir()) @@ -152,18 +145,14 @@ class MultiWalletTest(BitcoinTestFramework): # if wallets/ doesn't exist, datadir should be the default wallet dir wallet_dir2 = data_dir('walletdir') os.rename(wallet_dir(), wallet_dir2) - self.start_node(0) - self.nodes[0].createwallet("w4") - self.nodes[0].createwallet("w5") + self.start_node(0, ['-nowallet', '-wallet=w4', '-wallet=w5']) assert_equal(set(node.listwallets()), {"w4", "w5"}) w5 = wallet("w5") node.generatetoaddress(nblocks=1, address=w5.getnewaddress()) # now if wallets/ exists again, but the rootdir is specified as the walletdir, w4 and w5 should still be loaded os.rename(wallet_dir2, wallet_dir()) - self.restart_node(0, ['-nowallet', '-walletdir=' + data_dir()]) - self.nodes[0].loadwallet("w4") - self.nodes[0].loadwallet("w5") + self.restart_node(0, ['-nowallet', '-wallet=w4', '-wallet=w5', '-walletdir=' + data_dir()]) assert_equal(set(node.listwallets()), {"w4", "w5"}) w5 = wallet("w5") w5_info = w5.getwalletinfo() @@ -171,14 +160,11 @@ class MultiWalletTest(BitcoinTestFramework): competing_wallet_dir = os.path.join(self.options.tmpdir, 'competing_walletdir') os.mkdir(competing_wallet_dir) - self.restart_node(0, ['-nowallet', '-walletdir=' + competing_wallet_dir]) - self.nodes[0].createwallet(self.default_wallet_name) + self.restart_node(0, ['-walletdir=' + competing_wallet_dir]) exp_stderr = r"Error: Error initializing wallet database environment \"\S+competing_walletdir\"!" self.nodes[1].assert_start_raises_init_error(['-walletdir=' + competing_wallet_dir], exp_stderr, match=ErrorMatch.PARTIAL_REGEX) - self.restart_node(0) - for wallet_name in wallet_names: - self.nodes[0].loadwallet(wallet_name) + self.restart_node(0, extra_args) assert_equal(sorted(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), [self.default_wallet_name, os.path.join('sub', 'w5'), 'w', 'w1', 'w2', 'w3', 'w7', 'w7_symlink', 'w8', 'w8_copy']) From 096ebad3ccaf43a98d4b0815c249d3515ebed4ca Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Tue, 8 Nov 2022 23:11:44 +0530 Subject: [PATCH 2/3] revert: merge bitcoin#20034 (Get rid of default wallet hacks) reverts 1a2dbc81c542162e73a24751c5b81dada2982e62 --- test/functional/feature_config_args.py | 1 - test/functional/feature_fee_estimation.py | 6 +-- test/functional/feature_filelock.py | 5 +-- test/functional/feature_notifications.py | 2 +- test/functional/feature_pruning.py | 3 +- test/functional/feature_settings.py | 1 - test/functional/rpc_platform_filter.py | 5 +-- .../test_framework/test_framework.py | 27 +++++--------- test/functional/tool_wallet.py | 10 ++--- test/functional/wallet_backup.py | 26 ++++++------- test/functional/wallet_balance.py | 4 +- test/functional/wallet_disable.py | 1 - test/functional/wallet_hd.py | 10 +---- test/functional/wallet_import_rescan.py | 7 ++-- test/functional/wallet_importmulti.py | 2 +- test/functional/wallet_keypool_topup.py | 2 +- test/functional/wallet_multiwallet.py | 37 ++++++++++--------- test/functional/wallet_reorgsrestore.py | 2 +- 18 files changed, 67 insertions(+), 84 deletions(-) diff --git a/test/functional/feature_config_args.py b/test/functional/feature_config_args.py index cfe15803a0..1ceec4129d 100755 --- a/test/functional/feature_config_args.py +++ b/test/functional/feature_config_args.py @@ -14,7 +14,6 @@ class ConfArgsTest(BitcoinTestFramework): self.setup_clean_chain = True self.num_nodes = 1 self.supports_cli = False - self.wallet_names = [] def test_config_file_parser(self): # Assume node is stopped diff --git a/test/functional/feature_fee_estimation.py b/test/functional/feature_fee_estimation.py index a6b01e8fd8..7c0db40eb8 100755 --- a/test/functional/feature_fee_estimation.py +++ b/test/functional/feature_fee_estimation.py @@ -125,9 +125,9 @@ class EstimateFeeTest(BitcoinTestFramework): self.num_nodes = 3 # mine non-standard txs (e.g. txs with "dust" outputs) self.extra_args = [ - ["-acceptnonstdtxn=1", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1"], - ["-acceptnonstdtxn=1", "-blockmaxsize=17000", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1"], - ["-acceptnonstdtxn=1", "-blockmaxsize=8000", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1"] + ["-acceptnonstdtxn=1", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1", "-wallet="], + ["-acceptnonstdtxn=1", "-blockmaxsize=17000", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1", "-wallet="], + ["-acceptnonstdtxn=1", "-blockmaxsize=8000", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1", "-wallet="] ] def skip_test_if_missing_module(self): diff --git a/test/functional/feature_filelock.py b/test/functional/feature_filelock.py index 2844a635a9..5bad9639ed 100755 --- a/test/functional/feature_filelock.py +++ b/test/functional/feature_filelock.py @@ -15,7 +15,7 @@ class FilelockTest(BitcoinTestFramework): def setup_network(self): self.add_nodes(self.num_nodes, extra_args=None) - self.nodes[0].start() + self.nodes[0].start(['-wallet=']) self.nodes[0].wait_for_rpc_connection() def run_test(self): @@ -27,11 +27,10 @@ class FilelockTest(BitcoinTestFramework): self.nodes[1].assert_start_raises_init_error(extra_args=['-datadir={}'.format(self.nodes[0].datadir), '-noserver'], expected_msg=expected_msg) if self.is_wallet_compiled(): - self.nodes[0].createwallet(self.default_wallet_name) wallet_dir = os.path.join(datadir, 'wallets') self.log.info("Check that we can't start a second dashd instance using the same wallet") expected_msg = "Error: Error initializing wallet database environment" - self.nodes[1].assert_start_raises_init_error(extra_args=['-walletdir={}'.format(wallet_dir), '-wallet=' + self.default_wallet_name, '-noserver'], expected_msg=expected_msg, match=ErrorMatch.PARTIAL_REGEX) + self.nodes[1].assert_start_raises_init_error(extra_args=['-walletdir={}'.format(wallet_dir), '-wallet=', '-noserver'], expected_msg=expected_msg, match=ErrorMatch.PARTIAL_REGEX) if __name__ == '__main__': FilelockTest().main() diff --git a/test/functional/feature_notifications.py b/test/functional/feature_notifications.py index 3265ab97e2..48f53dd6a0 100755 --- a/test/functional/feature_notifications.py +++ b/test/functional/feature_notifications.py @@ -43,8 +43,8 @@ class NotificationsTest(BitcoinTestFramework): "-blocknotify=echo > {}".format(os.path.join(self.blocknotify_dir, '%s'))], ["-blockversion=211", "-rescan", + "-wallet={}".format(self.wallet), "-walletnotify=echo > {}".format(os.path.join(self.walletnotify_dir, notify_outputname('%w', '%s')))]] - self.wallet_names = [self.default_wallet_name, self.wallet] super().setup_network() def run_test(self): diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py index 5ddbfe9b05..df1f13a1e7 100755 --- a/test/functional/feature_pruning.py +++ b/test/functional/feature_pruning.py @@ -106,7 +106,8 @@ class PruneTest(BitcoinTestFramework): def setup_nodes(self): self.add_nodes(self.num_nodes, self.extra_args) self.start_nodes() - self.import_deterministic_coinbase_privkeys() + for n in self.nodes: + n.importprivkey(privkey=n.get_deterministic_priv_key().key, label='coinbase', rescan=False) def create_big_chain(self): # Start by creating some coinbases we can spend later diff --git a/test/functional/feature_settings.py b/test/functional/feature_settings.py index f107acc699..2c4cf9c20a 100755 --- a/test/functional/feature_settings.py +++ b/test/functional/feature_settings.py @@ -17,7 +17,6 @@ class SettingsTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 1 - self.wallet_names = [] def run_test(self): node, = self.nodes diff --git a/test/functional/rpc_platform_filter.py b/test/functional/rpc_platform_filter.py index eba00b3782..6e678b50a7 100755 --- a/test/functional/rpc_platform_filter.py +++ b/test/functional/rpc_platform_filter.py @@ -18,10 +18,6 @@ class HTTPBasicsTest(BitcoinTestFramework): self.num_nodes = 1 self.supports_cli = False - def setup_nodes(self): - self.add_nodes(self.num_nodes) - self.start_nodes() - def setup_chain(self): super().setup_chain() # Append rpcauth to dash.conf before initialization @@ -40,6 +36,7 @@ class HTTPBasicsTest(BitcoinTestFramework): f.write(rpcauthoperator+"\n") def run_test(self): + url = urllib.parse.urlparse(self.nodes[0].url) def test_command(method, params, auth, expexted_status, should_not_match=False): diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 6c639cf154..b04df12082 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -117,17 +117,9 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): self.rpc_timeout = 60 # Wait for up to 60 seconds for the RPC server to respond self.supports_cli = True self.bind_to_localhost_only = True - self.parse_args() - self.default_wallet_name = "" - self.wallet_data_filename = "wallet.dat" self.extra_args_from_options = [] - # Optional list of wallet names that can be set in set_test_params to - # create and import keys to. If unset, default is len(nodes) * - # [default_wallet_name]. If wallet names are None, wallet creation is - # skipped. If list is truncated, wallet creation is skipped and keys - # are not imported. - self.wallet_names = None self.set_test_params() + self.parse_args() if self.options.timeout_factor == 0 : self.options.timeout_factor = 99999 self.rpc_timeout = int(self.rpc_timeout * self.options.timeout_factor) # optionally, increase timeout by a factor @@ -395,8 +387,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): extra_args = self.extra_args self.add_nodes(self.num_nodes, extra_args) self.start_nodes() - if self.is_wallet_compiled(): - self.import_deterministic_coinbase_privkeys() + self.import_deterministic_coinbase_privkeys() if not self.setup_clean_chain: for n in self.nodes: assert_equal(n.getblockchaininfo()["blocks"], 199) @@ -413,11 +404,13 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): assert_equal(chain_info["initialblockdownload"], False) def import_deterministic_coinbase_privkeys(self): - wallet_names = [self.default_wallet_name] * len(self.nodes) if self.wallet_names is None else self.wallet_names - assert len(wallet_names) <= len(self.nodes) - for wallet_name, n in zip(wallet_names, self.nodes): - if wallet_name is not None: - n.createwallet(wallet_name=wallet_name, load_on_startup=True) + for n in self.nodes: + try: + n.getwalletinfo() + except JSONRPCException as e: + assert str(e).startswith('Method not found') + continue + n.importprivkey(privkey=n.get_deterministic_priv_key().key, label='coinbase') def run_test(self): @@ -935,7 +928,6 @@ class DashTestFramework(BitcoinTestFramework): idx = len(self.nodes) self.add_nodes(1, extra_args=[self.extra_args[idx]]) self.start_node(idx) - self.nodes[idx].createwallet(self.default_wallet_name) for i in range(0, idx): self.connect_nodes(i, idx) @@ -1095,6 +1087,7 @@ class DashTestFramework(BitcoinTestFramework): self.prepare_masternodes() self.prepare_datadirs() self.start_masternodes() + self.import_deterministic_coinbase_privkeys() # non-masternodes where disconnected from the control node during prepare_datadirs, # let's reconnect them back to make sure they receive updates diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py index 9feaf4e192..1a225c0d8e 100755 --- a/test/functional/tool_wallet.py +++ b/test/functional/tool_wallet.py @@ -72,7 +72,7 @@ class ToolWalletTest(BitcoinTestFramework): locked_dir = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets") self.assert_raises_tool_error( 'Error initializing wallet database environment "{}"!'.format(locked_dir), - '-wallet=' + self.default_wallet_name, + '-wallet=wallet.dat', 'info', ) path = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets", "nonexistent.dat") @@ -118,7 +118,7 @@ class ToolWalletTest(BitcoinTestFramework): Transactions: 0 Address Book: 1 ''') - self.assert_tool_output(out, '-wallet=' + self.default_wallet_name, 'info') + self.assert_tool_output(out, '-wallet=wallet.dat', 'info') timestamp_after = self.wallet_timestamp() self.log.debug('Wallet file timestamp after calling info: {}'.format(timestamp_after)) self.log_wallet_timestamp_comparison(timestamp_before, timestamp_after) @@ -157,7 +157,7 @@ class ToolWalletTest(BitcoinTestFramework): Transactions: 1 Address Book: 1 ''') - self.assert_tool_output(out, '-wallet=' + self.default_wallet_name, 'info') + self.assert_tool_output(out, '-wallet=wallet.dat', 'info') shasum_after = self.wallet_shasum() timestamp_after = self.wallet_timestamp() self.log.debug('Wallet file timestamp after calling info: {}'.format(timestamp_after)) @@ -195,7 +195,7 @@ class ToolWalletTest(BitcoinTestFramework): def test_getwalletinfo_on_different_wallet(self): self.log.info('Starting node with arg -wallet=foo') - self.start_node(0, ['-nowallet', '-wallet=foo']) + self.start_node(0, ['-wallet=foo']) self.log.info('Calling getwalletinfo on a different wallet ("foo"), testing output') shasum_before = self.wallet_shasum() @@ -225,7 +225,7 @@ class ToolWalletTest(BitcoinTestFramework): self.assert_tool_output('', '-wallet=salvage', 'salvage') def run_test(self): - self.wallet_path = os.path.join(self.nodes[0].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename) + self.wallet_path = os.path.join(self.nodes[0].datadir, self.chain, 'wallets', 'wallet.dat') self.test_invalid_tool_commands_and_args() # Warning: The following tests are order-dependent. self.test_tool_wallet_info() diff --git a/test/functional/wallet_backup.py b/test/functional/wallet_backup.py index 93ae5a8608..cbe9c27302 100755 --- a/test/functional/wallet_backup.py +++ b/test/functional/wallet_backup.py @@ -45,10 +45,10 @@ class WalletBackupTest(BitcoinTestFramework): # nodes 1, 2,3 are spenders, let's give them a keypool=100 # whitelist all peers to speed up tx relay / mempool sync self.extra_args = [ - ["-whitelist=noban@127.0.0.1", "-keypool=100"], - ["-whitelist=noban@127.0.0.1", "-keypool=100"], - ["-whitelist=noban@127.0.0.1", "-keypool=100"], - ["-whitelist=noban@127.0.0.1"], + ["-whitelist=noban@127.0.0.1", "-keypool=100", "-wallet="], + ["-whitelist=noban@127.0.0.1", "-keypool=100", "-wallet="], + ["-whitelist=noban@127.0.0.1", "-keypool=100", "-wallet="], + ["-whitelist=noban@127.0.0.1", "-wallet="], ] self.rpc_timeout = 120 @@ -102,9 +102,9 @@ class WalletBackupTest(BitcoinTestFramework): self.stop_node(2) def erase_three(self): - os.remove(os.path.join(self.nodes[0].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) - os.remove(os.path.join(self.nodes[1].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) - os.remove(os.path.join(self.nodes[2].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) + os.remove(os.path.join(self.nodes[0].datadir, self.chain, 'wallets', 'wallet.dat')) + os.remove(os.path.join(self.nodes[1].datadir, self.chain, 'wallets', 'wallet.dat')) + os.remove(os.path.join(self.nodes[2].datadir, self.chain, 'wallets', 'wallet.dat')) def run_test(self): self.log.info("Generating initial blockchain") @@ -168,9 +168,9 @@ class WalletBackupTest(BitcoinTestFramework): shutil.rmtree(os.path.join(self.nodes[2].datadir, self.chain, 'llmq')) # Restore wallets from backup - shutil.copyfile(os.path.join(self.nodes[0].datadir, 'wallet.bak'), os.path.join(self.nodes[0].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) - shutil.copyfile(os.path.join(self.nodes[1].datadir, 'wallet.bak'), os.path.join(self.nodes[1].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) - shutil.copyfile(os.path.join(self.nodes[2].datadir, 'wallet.bak'), os.path.join(self.nodes[2].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)) + shutil.copyfile(os.path.join(self.nodes[0].datadir, 'wallet.bak'), os.path.join(self.nodes[0].datadir, self.chain, 'wallets', 'wallet.dat')) + shutil.copyfile(os.path.join(self.nodes[1].datadir, 'wallet.bak'), os.path.join(self.nodes[1].datadir, self.chain, 'wallets', 'wallet.dat')) + shutil.copyfile(os.path.join(self.nodes[2].datadir, 'wallet.bak'), os.path.join(self.nodes[2].datadir, self.chain, 'wallets', 'wallet.dat')) self.log.info("Re-starting nodes") self.start_three() @@ -208,9 +208,9 @@ class WalletBackupTest(BitcoinTestFramework): # Backup to source wallet file must fail sourcePaths = [ - os.path.join(self.nodes[0].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename), - os.path.join(self.nodes[0].datadir, self.chain, '.', 'wallets', self.default_wallet_name, self.wallet_data_filename), - os.path.join(self.nodes[0].datadir, self.chain, 'wallets', self.default_wallet_name), + os.path.join(self.nodes[0].datadir, self.chain, 'wallets', 'wallet.dat'), + os.path.join(self.nodes[0].datadir, self.chain, '.', 'wallets', 'wallet.dat'), + os.path.join(self.nodes[0].datadir, self.chain, 'wallets', ''), os.path.join(self.nodes[0].datadir, self.chain, 'wallets')] for sourcePath in sourcePaths: diff --git a/test/functional/wallet_balance.py b/test/functional/wallet_balance.py index b05fd0ba32..392b803c42 100755 --- a/test/functional/wallet_balance.py +++ b/test/functional/wallet_balance.py @@ -165,10 +165,10 @@ class WalletTest(BitcoinTestFramework): # dynamically loading the wallet. before = self.nodes[1].getunconfirmedbalance() dst = self.nodes[1].getnewaddress() - self.nodes[1].unloadwallet(self.default_wallet_name) + self.nodes[1].unloadwallet('') self.nodes[0].sendtoaddress(dst, 0.1) self.sync_all() - self.nodes[1].loadwallet(self.default_wallet_name) + self.nodes[1].loadwallet('') after = self.nodes[1].getunconfirmedbalance() assert_equal(before + Decimal('0.1'), after) diff --git a/test/functional/wallet_disable.py b/test/functional/wallet_disable.py index 4f3275b73f..99ea3c7975 100755 --- a/test/functional/wallet_disable.py +++ b/test/functional/wallet_disable.py @@ -16,7 +16,6 @@ class DisableWalletTest (BitcoinTestFramework): self.setup_clean_chain = True self.num_nodes = 1 self.extra_args = [["-disablewallet"]] - self.wallet_names = [] def run_test (self): # Make sure wallet is really disabled diff --git a/test/functional/wallet_hd.py b/test/functional/wallet_hd.py index 23faa21d67..571aca2daa 100755 --- a/test/functional/wallet_hd.py +++ b/test/functional/wallet_hd.py @@ -81,10 +81,7 @@ class WalletHDTest(BitcoinTestFramework): shutil.rmtree(os.path.join(self.nodes[1].datadir, self.chain, "chainstate")) shutil.rmtree(os.path.join(self.nodes[1].datadir, self.chain, "evodb")) shutil.rmtree(os.path.join(self.nodes[1].datadir, self.chain, "llmq")) - shutil.copyfile( - os.path.join(self.nodes[1].datadir, "hd.bak"), - os.path.join(self.nodes[1].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename), - ) + shutil.copyfile(os.path.join(self.nodes[1].datadir, "hd.bak"), os.path.join(self.nodes[1].datadir, self.chain, "wallets", "wallet.dat")) self.start_node(1) # Assert that derivation is deterministic @@ -109,10 +106,7 @@ class WalletHDTest(BitcoinTestFramework): shutil.rmtree(os.path.join(self.nodes[1].datadir, self.chain, "chainstate")) shutil.rmtree(os.path.join(self.nodes[1].datadir, self.chain, "evodb")) shutil.rmtree(os.path.join(self.nodes[1].datadir, self.chain, "llmq")) - shutil.copyfile( - os.path.join(self.nodes[1].datadir, "hd.bak"), - os.path.join(self.nodes[1].datadir, self.chain, "wallets", self.default_wallet_name, self.wallet_data_filename), - ) + shutil.copyfile(os.path.join(self.nodes[1].datadir, "hd.bak"), os.path.join(self.nodes[1].datadir, self.chain, "wallets", "wallet.dat")) self.start_node(1, extra_args=self.extra_args[1]) self.connect_nodes(0, 1) self.sync_all() diff --git a/test/functional/wallet_import_rescan.py b/test/functional/wallet_import_rescan.py index 691add8697..64d4deec0a 100755 --- a/test/functional/wallet_import_rescan.py +++ b/test/functional/wallet_import_rescan.py @@ -125,7 +125,7 @@ class ImportRescanTest(BitcoinTestFramework): self.skip_if_no_wallet() def setup_network(self): - extra_args = [[] for _ in range(self.num_nodes)] + extra_args = [["-wallet="] for _ in range(self.num_nodes)] for i, import_node in enumerate(IMPORT_NODES, 2): if import_node.prune: # txindex is enabled by default in Dash and needs to be disabled for import-rescan.py @@ -134,8 +134,9 @@ class ImportRescanTest(BitcoinTestFramework): self.add_nodes(self.num_nodes, extra_args=extra_args) # Import keys with pruning disabled - self.start_nodes(extra_args=[[]] * self.num_nodes) - self.import_deterministic_coinbase_privkeys() + self.start_nodes(extra_args=[["-wallet="]] * self.num_nodes) + for n in self.nodes: + n.importprivkey(privkey=n.get_deterministic_priv_key().key, label='coinbase') self.stop_nodes() self.start_nodes() diff --git a/test/functional/wallet_importmulti.py b/test/functional/wallet_importmulti.py index e129eb02e2..aba07e79fd 100755 --- a/test/functional/wallet_importmulti.py +++ b/test/functional/wallet_importmulti.py @@ -673,7 +673,7 @@ class ImportMultiTest(BitcoinTestFramework): # Cannot import those pubkeys to keypool of wallet with privkeys self.log.info("Pubkeys cannot be added to the keypool of a wallet with private keys") - wrpc = self.nodes[1].get_wallet_rpc(self.default_wallet_name) + wrpc = self.nodes[1].get_wallet_rpc("") assert wrpc.getwalletinfo()['private_keys_enabled'] result = wrpc.importmulti( [{ diff --git a/test/functional/wallet_keypool_topup.py b/test/functional/wallet_keypool_topup.py index a44866b8b1..92b4f52ed5 100755 --- a/test/functional/wallet_keypool_topup.py +++ b/test/functional/wallet_keypool_topup.py @@ -29,7 +29,7 @@ class KeypoolRestoreTest(BitcoinTestFramework): self.skip_if_no_wallet() def run_test(self): - wallet_path = os.path.join(self.nodes[1].datadir, self.chain, "wallets", self.default_wallet_name, self.wallet_data_filename) + wallet_path = os.path.join(self.nodes[1].datadir, self.chain, "wallets", "wallet.dat") wallet_backup_path = os.path.join(self.nodes[1].datadir, "wallet.bak") self.nodes[0].generate(101) diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py index d7d3fd7cbf..a39751d921 100755 --- a/test/functional/wallet_multiwallet.py +++ b/test/functional/wallet_multiwallet.py @@ -43,6 +43,7 @@ class MultiWalletTest(BitcoinTestFramework): self.setup_clean_chain = True self.num_nodes = 2 self.rpc_timeout = 120 + self.extra_args = [["-wallet="], ["-wallet="]] def skip_test_if_missing_module(self): self.skip_if_no_wallet() @@ -63,14 +64,14 @@ class MultiWalletTest(BitcoinTestFramework): def wallet_file(name): if os.path.isdir(wallet_dir(name)): - return wallet_dir(name, self.wallet_data_filename) + return wallet_dir(name, "wallet.dat") return wallet_dir(name) - assert_equal(self.nodes[0].listwalletdir(), { 'wallets': [{ 'name': self.default_wallet_name }] }) + assert_equal(self.nodes[0].listwalletdir(), { 'wallets': [{ 'name': '' }] }) # check wallet.dat is created self.stop_nodes() - assert_equal(os.path.isfile(wallet_dir(self.default_wallet_name, self.wallet_data_filename)), True) + assert_equal(os.path.isfile(wallet_dir('wallet.dat')), True) # create symlink to verify wallet directory path can be referenced # through symlink @@ -80,13 +81,13 @@ class MultiWalletTest(BitcoinTestFramework): # rename wallet.dat to make sure plain wallet file paths (as opposed to # directory paths) can be loaded - os.rename(wallet_dir(self.default_wallet_name, self.wallet_data_filename), wallet_dir("w8")) + os.rename(wallet_dir("wallet.dat"), wallet_dir("w8")) # create another dummy wallet for use in testing backups later - self.start_node(0, ["-nowallet", "-wallet=" + self.default_wallet_name]) + self.start_node(0, ["-wallet="]) self.stop_nodes() empty_wallet = os.path.join(self.options.tmpdir, 'empty.dat') - os.rename(wallet_dir(self.default_wallet_name, self.wallet_data_filename), empty_wallet) + os.rename(wallet_dir("wallet.dat"), empty_wallet) # restart node with a mix of wallet names: # w1, w2, w3 - to verify new wallets created when non-existing paths specified @@ -96,12 +97,12 @@ class MultiWalletTest(BitcoinTestFramework): # w7_symlink - to verify symlinked wallet path is initialized correctly # w8 - to verify existing wallet file is loaded correctly # '' - to verify default wallet file is created correctly - wallet_names = ['w1', 'w2', 'w3', 'w', 'sub/w5', os.path.join(self.options.tmpdir, 'extern/w6'), 'w7_symlink', 'w8', self.default_wallet_name] + wallet_names = ['w1', 'w2', 'w3', 'w', 'sub/w5', os.path.join(self.options.tmpdir, 'extern/w6'), 'w7_symlink', 'w8', ''] if os.name == 'nt': wallet_names.remove('w7_symlink') - extra_args = ['-nowallet'] + ['-wallet={}'.format(n) for n in wallet_names] + extra_args = ['-wallet={}'.format(n) for n in wallet_names] self.start_node(0, extra_args) - assert_equal(sorted(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), [self.default_wallet_name, os.path.join('sub', 'w5'), 'w', 'w1', 'w2', 'w3', 'w7', 'w7_symlink', 'w8']) + assert_equal(sorted(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), ['', os.path.join('sub', 'w5'), 'w', 'w1', 'w2', 'w3', 'w7', 'w7_symlink', 'w8']) assert_equal(set(node.listwallets()), set(wallet_names)) @@ -112,7 +113,7 @@ class MultiWalletTest(BitcoinTestFramework): # should not initialize if wallet path can't be created exp_stderr = "boost::filesystem::create_directory:" - self.nodes[0].assert_start_raises_init_error(['-wallet=w8/bad'], exp_stderr, match=ErrorMatch.PARTIAL_REGEX) + self.nodes[0].assert_start_raises_init_error(['-wallet=wallet.dat/bad'], exp_stderr, match=ErrorMatch.PARTIAL_REGEX) self.nodes[0].assert_start_raises_init_error(['-walletdir=wallets'], 'Error: Specified -walletdir "wallets" does not exist') self.nodes[0].assert_start_raises_init_error(['-walletdir=wallets'], 'Error: Specified -walletdir "wallets" is a relative path', cwd=data_dir()) @@ -145,14 +146,14 @@ class MultiWalletTest(BitcoinTestFramework): # if wallets/ doesn't exist, datadir should be the default wallet dir wallet_dir2 = data_dir('walletdir') os.rename(wallet_dir(), wallet_dir2) - self.start_node(0, ['-nowallet', '-wallet=w4', '-wallet=w5']) + self.start_node(0, ['-wallet=w4', '-wallet=w5']) assert_equal(set(node.listwallets()), {"w4", "w5"}) w5 = wallet("w5") node.generatetoaddress(nblocks=1, address=w5.getnewaddress()) # now if wallets/ exists again, but the rootdir is specified as the walletdir, w4 and w5 should still be loaded os.rename(wallet_dir2, wallet_dir()) - self.restart_node(0, ['-nowallet', '-wallet=w4', '-wallet=w5', '-walletdir=' + data_dir()]) + self.restart_node(0, ['-wallet=w4', '-wallet=w5', '-walletdir=' + data_dir()]) assert_equal(set(node.listwallets()), {"w4", "w5"}) w5 = wallet("w5") w5_info = w5.getwalletinfo() @@ -160,13 +161,13 @@ class MultiWalletTest(BitcoinTestFramework): competing_wallet_dir = os.path.join(self.options.tmpdir, 'competing_walletdir') os.mkdir(competing_wallet_dir) - self.restart_node(0, ['-walletdir=' + competing_wallet_dir]) + self.restart_node(0, ['-walletdir=' + competing_wallet_dir, '-wallet=']) exp_stderr = r"Error: Error initializing wallet database environment \"\S+competing_walletdir\"!" self.nodes[1].assert_start_raises_init_error(['-walletdir=' + competing_wallet_dir], exp_stderr, match=ErrorMatch.PARTIAL_REGEX) self.restart_node(0, extra_args) - assert_equal(sorted(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), [self.default_wallet_name, os.path.join('sub', 'w5'), 'w', 'w1', 'w2', 'w3', 'w7', 'w7_symlink', 'w8', 'w8_copy']) + assert_equal(sorted(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), ['', os.path.join('sub', 'w5'), 'w', 'w1', 'w2', 'w3', 'w7', 'w7_symlink', 'w8', 'w8_copy']) wallets = [wallet(w) for w in wallet_names] wallet_bad = wallet("bad") @@ -256,12 +257,12 @@ class MultiWalletTest(BitcoinTestFramework): assert_raises_rpc_error(-18, "Wallet file verification failed. Failed to load database path '{}'. Path does not exist.".format(path), self.nodes[0].loadwallet, 'wallets') # Fail to load duplicate wallets - path = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets", "w1", self.wallet_data_filename) + path = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets", "w1", "wallet.dat") assert_raises_rpc_error(-4, "Wallet file verification failed. Refusing to load database. Data file '{}' is already loaded.".format(path), self.nodes[0].loadwallet, wallet_names[0]) # Fail to load duplicate wallets by different ways (directory and filepath) - path = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets", self.wallet_data_filename) - assert_raises_rpc_error(-4, "Wallet file verification failed. Refusing to load database. Data file '{}' is already loaded.".format(path), self.nodes[0].loadwallet, self.wallet_data_filename) + path = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets", "wallet.dat") + assert_raises_rpc_error(-4, "Wallet file verification failed. Refusing to load database. Data file '{}' is already loaded.".format(path), self.nodes[0].loadwallet, 'wallet.dat') # Fail to load if one wallet is a copy of another assert_raises_rpc_error(-4, "BerkeleyDatabase: Can't open database w8_copy (duplicates fileid", self.nodes[0].loadwallet, 'w8_copy') @@ -334,7 +335,7 @@ class MultiWalletTest(BitcoinTestFramework): assert_equal(self.nodes[0].listwallets(), ['w1']) assert_equal(w1.getwalletinfo()['walletname'], 'w1') - assert_equal(sorted(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), [self.default_wallet_name, os.path.join('sub', 'w5'), 'w', 'w1', 'w2', 'w3', 'w7', 'w7_symlink', 'w8', 'w8_copy', 'w9']) + assert_equal(sorted(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), ['', os.path.join('sub', 'w5'), 'w', 'w1', 'w2', 'w3', 'w7', 'w7_symlink', 'w8', 'w8_copy', 'w9']) # Test backing up and restoring wallets self.log.info("Test wallet backup") diff --git a/test/functional/wallet_reorgsrestore.py b/test/functional/wallet_reorgsrestore.py index 434cf2c745..b88eba71e1 100755 --- a/test/functional/wallet_reorgsrestore.py +++ b/test/functional/wallet_reorgsrestore.py @@ -88,7 +88,7 @@ class ReorgsRestoreTest(BitcoinTestFramework): # Node0 wallet file is loaded on longest sync'ed node1 self.stop_node(1) self.nodes[0].backupwallet(os.path.join(self.nodes[0].datadir, 'wallet.bak')) - shutil.copyfile(os.path.join(self.nodes[0].datadir, 'wallet.bak'), os.path.join(self.nodes[1].datadir, self.chain, self.default_wallet_name, self.wallet_data_filename)) + shutil.copyfile(os.path.join(self.nodes[0].datadir, 'wallet.bak'), os.path.join(self.nodes[1].datadir, self.chain, 'wallet.dat')) self.start_node(1) tx_after_reorg = self.nodes[1].gettransaction(txid) # Check that normal confirmed tx is confirmed again but with different blockhash From 17dcbdd77a8a621c5cb866c8a18bf46ea2c3f649 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Tue, 8 Nov 2022 23:13:56 +0530 Subject: [PATCH 3/3] revert: merge bitcoin#15454 (Remove the automatic creation and loading of the default wallet) reverts b71ee6cbeeabcfc2b5fabb5f1a754e4c8cdb174f --- doc/release-notes-15454.md | 6 ------ src/interfaces/wallet.cpp | 11 +++++----- src/interfaces/wallet.h | 2 +- src/qt/bitcoingui.cpp | 5 ----- src/qt/bitcoingui.h | 1 - src/qt/guiutil.cpp | 2 +- src/qt/walletframe.cpp | 25 ++--------------------- src/wallet/init.cpp | 11 +++++++++- src/wallet/load.cpp | 25 ++++------------------- src/wallet/load.h | 4 ++-- src/wallet/test/init_test_fixture.cpp | 2 +- src/wallet/test/wallet_test_fixture.h | 2 +- src/wallet/wallet.cpp | 3 --- test/functional/feature_fee_estimation.py | 6 +++--- test/functional/feature_filelock.py | 4 ++-- test/functional/wallet_backup.py | 8 ++++---- test/functional/wallet_dump.py | 2 +- test/functional/wallet_import_rescan.py | 4 ++-- test/functional/wallet_multiwallet.py | 5 ++--- test/functional/wallet_startup.py | 10 --------- 20 files changed, 42 insertions(+), 96 deletions(-) delete mode 100644 doc/release-notes-15454.md diff --git a/doc/release-notes-15454.md b/doc/release-notes-15454.md deleted file mode 100644 index 9cb0368084..0000000000 --- a/doc/release-notes-15454.md +++ /dev/null @@ -1,6 +0,0 @@ -Wallet ------- - -Dash Core will no longer create an unnamed `""` wallet by default when no wallet is specified on the command line or in the configuration files. -For backwards compatibility, if an unnamed `""` wallet already exists and would have been loaded previously, then it will still be loaded. -Users without an unnamed `""` wallet and without any other wallets to be loaded on startup will be prompted to either choose a wallet to load, or to create a new wallet. diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index b48a10e6b2..d5adf405ab 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -581,7 +581,8 @@ public: class WalletClientImpl : public WalletClient { public: - WalletClientImpl(Chain& chain, ArgsManager& args) + WalletClientImpl(Chain& chain, ArgsManager& args, std::vector wallet_filenames) + : m_wallet_filenames(std::move(wallet_filenames)) { m_context.chain = &chain; m_context.args = &args; @@ -598,8 +599,8 @@ public: m_rpc_handlers.emplace_back(m_context.chain->handleRpc(m_rpc_commands.back())); } } - bool verify() override { return VerifyWallets(*m_context.chain); } - bool load() override { return LoadWallets(*m_context.chain); } + bool verify() override { return VerifyWallets(*m_context.chain, m_wallet_filenames); } + bool load() override { return LoadWallets(*m_context.chain, m_wallet_filenames); } void start(CScheduler& scheduler) override { return StartWallets(scheduler, *Assert(m_context.args)); } void flush() override { return FlushWallets(); } void stop() override { return StopWallets(); } @@ -658,9 +659,9 @@ public: std::unique_ptr MakeWallet(const std::shared_ptr& wallet) { return wallet ? std::make_unique(wallet) : nullptr; } -std::unique_ptr MakeWalletClient(Chain& chain, ArgsManager& args) +std::unique_ptr MakeWalletClient(Chain& chain, ArgsManager& args, std::vector wallet_filenames) { - return std::make_unique(chain, args); + return std::make_unique(chain, args, std::move(wallet_filenames)); } } // namespace interfaces diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index 768e9f9d63..b217dc857c 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -449,7 +449,7 @@ std::unique_ptr MakeWallet(const std::shared_ptr& wallet); //! Return implementation of ChainClient interface for a wallet client. This //! function will be undefined in builds where ENABLE_WALLET is false. -std::unique_ptr MakeWalletClient(Chain& chain, ArgsManager& args); +std::unique_ptr MakeWalletClient(Chain& chain, ArgsManager& args, std::vector wallet_filenames); } // namespace interfaces diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index acff2f2331..c30bb725ee 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -870,11 +870,6 @@ void BitcoinGUI::setWalletController(WalletController* wallet_controller) } } -WalletController* BitcoinGUI::getWalletController() -{ - return m_wallet_controller; -} - void BitcoinGUI::addWallet(WalletModel* walletModel) { if (!walletFrame) return; diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index bf8e280086..754b45572a 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -80,7 +80,6 @@ public: void setClientModel(ClientModel *clientModel = nullptr, interfaces::BlockAndHeaderTipInfo* tip_info = nullptr); #ifdef ENABLE_WALLET void setWalletController(WalletController* wallet_controller); - WalletController* getWalletController(); #endif #ifdef ENABLE_WALLET diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 3d4b39df8c..79497599f6 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -1455,7 +1455,7 @@ void updateFonts() std::vector vecIgnoreClasses{ "QWidget", "QDialog", "QFrame", "QStackedWidget", "QDesktopWidget", "QDesktopScreenWidget", "QTipLabel", "QMessageBox", "QMenu", "QComboBoxPrivateScroller", "QComboBoxPrivateContainer", - "QScrollBar", "QListView", "BitcoinGUI", "WalletView", "WalletFrame", "QVBoxLayout", "QGroupBox" + "QScrollBar", "QListView", "BitcoinGUI", "WalletView", "WalletFrame" }; std::vector vecIgnoreObjects{ "messagesWidget" diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index 5a478109d4..77d116f2c8 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -2,8 +2,6 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include -#include #include #include @@ -14,11 +12,8 @@ #include -#include #include #include -#include -#include WalletFrame::WalletFrame(BitcoinGUI* _gui) : QFrame(_gui), @@ -31,25 +26,9 @@ WalletFrame::WalletFrame(BitcoinGUI* _gui) : walletFrameLayout->setContentsMargins(0,0,0,0); walletFrameLayout->addWidget(walletStack); - // hbox for no wallet - QGroupBox* no_wallet_group = new QGroupBox(walletStack); - QVBoxLayout* no_wallet_layout = new QVBoxLayout(no_wallet_group); - - QLabel *noWallet = new QLabel(tr("No wallet has been loaded.\nGo to File > Open Wallet to load a wallet.\n- OR -")); + QLabel *noWallet = new QLabel(tr("No wallet has been loaded.")); noWallet->setAlignment(Qt::AlignCenter); - no_wallet_layout->addWidget(noWallet, 0, Qt::AlignHCenter | Qt::AlignBottom); - - // A button for create wallet dialog - QPushButton* create_wallet_button = new QPushButton(tr("Create a new wallet"), walletStack); - connect(create_wallet_button, &QPushButton::clicked, [this] { - auto activity = new CreateWalletActivity(gui->getWalletController(), this); - connect(activity, &CreateWalletActivity::finished, activity, &QObject::deleteLater); - activity->create(); - }); - no_wallet_layout->addWidget(create_wallet_button, 0, Qt::AlignHCenter | Qt::AlignTop); - no_wallet_group->setLayout(no_wallet_layout); - - walletStack->addWidget(no_wallet_group); + walletStack->addWidget(noWallet); masternodeListPage = new MasternodeList(); walletStack->addWidget(masternodeListPage); diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 636b3efe22..8faaef2c8c 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -166,7 +166,16 @@ void WalletInit::Construct(NodeContext& node) const LogPrintf("Wallet disabled!\n"); return; } - auto wallet_client = interfaces::MakeWalletClient(*node.chain, args); + // If there's no -wallet setting with a list of wallets to load, set it to + // load the default "" wallet. + if (!args.IsArgSet("wallet")) { + args.LockSettings([&](util::Settings& settings) { + util::SettingsValue wallets(util::SettingsValue::VARR); + wallets.push_back(""); // Default wallet name is "" + settings.rw_settings["wallet"] = wallets; + }); + } + auto wallet_client = interfaces::MakeWalletClient(*node.chain, args, args.GetArgs("-wallet")); node.wallet_client = wallet_client.get(); node.chain_clients.emplace_back(std::move(wallet_client)); } diff --git a/src/wallet/load.cpp b/src/wallet/load.cpp index e95e7a3b16..ea801ebef8 100644 --- a/src/wallet/load.cpp +++ b/src/wallet/load.cpp @@ -19,7 +19,7 @@ #include -bool VerifyWallets(interfaces::Chain& chain) +bool VerifyWallets(interfaces::Chain& chain, const std::vector& wallet_files) { if (gArgs.IsArgSet("-walletdir")) { fs::path wallet_dir = gArgs.GetArg("-walletdir", ""); @@ -44,27 +44,10 @@ bool VerifyWallets(interfaces::Chain& chain) chain.initMessage(_("Verifying wallet(s)...").translated); - // For backwards compatibility if an unnamed top level wallet exists in the - // wallets directory, include it in the default list of wallets to load. - if (!gArgs.IsArgSet("wallet")) { - DatabaseOptions options; - DatabaseStatus status; - bilingual_str error_string; - options.require_existing = true; - options.verify = false; - if (MakeWalletDatabase("", options, status, error_string)) { - gArgs.LockSettings([&](util::Settings& settings) { - util::SettingsValue wallets(util::SettingsValue::VARR); - wallets.push_back(""); // Default wallet name is "" - settings.rw_settings["wallet"] = wallets; - }); - } - } - // Keep track of each wallet absolute path to detect duplicates. std::set wallet_paths; - for (const auto& wallet_file : gArgs.GetArgs("-wallet")) { + for (const auto& wallet_file : wallet_files) { const fs::path path = fs::absolute(wallet_file, GetWalletDir()); if (!wallet_paths.insert(path).second) { @@ -85,10 +68,10 @@ bool VerifyWallets(interfaces::Chain& chain) return true; } -bool LoadWallets(interfaces::Chain& chain) +bool LoadWallets(interfaces::Chain& chain, const std::vector& wallet_files) { try { - for (const std::string& name : gArgs.GetArgs("-wallet")) { + for (const std::string& name : wallet_files) { DatabaseOptions options; DatabaseStatus status; options.verify = false; // No need to verify, assuming verified earlier in VerifyWallets() diff --git a/src/wallet/load.h b/src/wallet/load.h index 7f7787c64b..5d9dfd03d0 100644 --- a/src/wallet/load.h +++ b/src/wallet/load.h @@ -18,10 +18,10 @@ class Chain; } // namespace interfaces //! Responsible for reading and validating the -wallet arguments and verifying the wallet database. -bool VerifyWallets(interfaces::Chain& chain); +bool VerifyWallets(interfaces::Chain& chain, const std::vector& wallet_files); //! Load wallet databases. -bool LoadWallets(interfaces::Chain& chain); +bool LoadWallets(interfaces::Chain& chain, const std::vector& wallet_files); //! Complete startup of wallets. void StartWallets(CScheduler& scheduler, const ArgsManager& args); diff --git a/src/wallet/test/init_test_fixture.cpp b/src/wallet/test/init_test_fixture.cpp index 8f8a197d9f..704ba7371c 100644 --- a/src/wallet/test/init_test_fixture.cpp +++ b/src/wallet/test/init_test_fixture.cpp @@ -10,7 +10,7 @@ InitWalletDirTestingSetup::InitWalletDirTestingSetup(const std::string& chainName) : BasicTestingSetup(chainName) { - m_wallet_client = MakeWalletClient(*m_chain, *Assert(m_node.args)); + m_wallet_client = MakeWalletClient(*m_chain, *Assert(m_node.args), {}); std::string sep; sep += fs::path::preferred_separator; diff --git a/src/wallet/test/wallet_test_fixture.h b/src/wallet/test/wallet_test_fixture.h index c35ec2eede..0faeee4b4a 100644 --- a/src/wallet/test/wallet_test_fixture.h +++ b/src/wallet/test/wallet_test_fixture.h @@ -21,7 +21,7 @@ struct WalletTestingSetup : public TestingSetup { explicit WalletTestingSetup(const std::string& chainName = CBaseChainParams::MAIN); std::unique_ptr m_chain = interfaces::MakeChain(m_node); - std::unique_ptr m_wallet_client = interfaces::MakeWalletClient(*m_chain, *Assert(m_node.args)); + std::unique_ptr m_wallet_client = interfaces::MakeWalletClient(*m_chain, *Assert(m_node.args), {}); CWallet m_wallet; std::unique_ptr m_chain_notifications_handler; }; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 435f613ca8..f1b3ac3f61 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -37,7 +37,6 @@ #include #include #include -#include #include #include @@ -113,7 +112,6 @@ bool AddWallet(const std::shared_ptr& wallet) if (i != vpwallets.end()) return false; coinJoinClientManagers.emplace(std::make_pair(wallet->GetName(), std::make_shared(*wallet))); vpwallets.push_back(wallet); - g_wallet_init_interface.InitCoinJoinSettings(); return true; } @@ -132,7 +130,6 @@ bool RemoveWallet(const std::shared_ptr& wallet, std::optional lo vpwallets.erase(i); auto it = coinJoinClientManagers.find(wallet->GetName()); coinJoinClientManagers.erase(it); - g_wallet_init_interface.InitCoinJoinSettings(); // Write the wallet setting UpdateWalletSetting(chain, name, load_on_start, warnings); diff --git a/test/functional/feature_fee_estimation.py b/test/functional/feature_fee_estimation.py index 7c0db40eb8..a6b01e8fd8 100755 --- a/test/functional/feature_fee_estimation.py +++ b/test/functional/feature_fee_estimation.py @@ -125,9 +125,9 @@ class EstimateFeeTest(BitcoinTestFramework): self.num_nodes = 3 # mine non-standard txs (e.g. txs with "dust" outputs) self.extra_args = [ - ["-acceptnonstdtxn=1", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1", "-wallet="], - ["-acceptnonstdtxn=1", "-blockmaxsize=17000", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1", "-wallet="], - ["-acceptnonstdtxn=1", "-blockmaxsize=8000", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1", "-wallet="] + ["-acceptnonstdtxn=1", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1"], + ["-acceptnonstdtxn=1", "-blockmaxsize=17000", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1"], + ["-acceptnonstdtxn=1", "-blockmaxsize=8000", "-maxorphantxsize=1000", "-whitelist=noban@127.0.0.1"] ] def skip_test_if_missing_module(self): diff --git a/test/functional/feature_filelock.py b/test/functional/feature_filelock.py index 5bad9639ed..748e0792a4 100755 --- a/test/functional/feature_filelock.py +++ b/test/functional/feature_filelock.py @@ -15,7 +15,7 @@ class FilelockTest(BitcoinTestFramework): def setup_network(self): self.add_nodes(self.num_nodes, extra_args=None) - self.nodes[0].start(['-wallet=']) + self.nodes[0].start([]) self.nodes[0].wait_for_rpc_connection() def run_test(self): @@ -30,7 +30,7 @@ class FilelockTest(BitcoinTestFramework): wallet_dir = os.path.join(datadir, 'wallets') self.log.info("Check that we can't start a second dashd instance using the same wallet") expected_msg = "Error: Error initializing wallet database environment" - self.nodes[1].assert_start_raises_init_error(extra_args=['-walletdir={}'.format(wallet_dir), '-wallet=', '-noserver'], expected_msg=expected_msg, match=ErrorMatch.PARTIAL_REGEX) + self.nodes[1].assert_start_raises_init_error(extra_args=['-walletdir={}'.format(wallet_dir), '-noserver'], expected_msg=expected_msg, match=ErrorMatch.PARTIAL_REGEX) if __name__ == '__main__': FilelockTest().main() diff --git a/test/functional/wallet_backup.py b/test/functional/wallet_backup.py index cbe9c27302..c9b2915d28 100755 --- a/test/functional/wallet_backup.py +++ b/test/functional/wallet_backup.py @@ -45,10 +45,10 @@ class WalletBackupTest(BitcoinTestFramework): # nodes 1, 2,3 are spenders, let's give them a keypool=100 # whitelist all peers to speed up tx relay / mempool sync self.extra_args = [ - ["-whitelist=noban@127.0.0.1", "-keypool=100", "-wallet="], - ["-whitelist=noban@127.0.0.1", "-keypool=100", "-wallet="], - ["-whitelist=noban@127.0.0.1", "-keypool=100", "-wallet="], - ["-whitelist=noban@127.0.0.1", "-wallet="], + ["-whitelist=noban@127.0.0.1", "-keypool=100"], + ["-whitelist=noban@127.0.0.1", "-keypool=100"], + ["-whitelist=noban@127.0.0.1", "-keypool=100"], + ["-whitelist=noban@127.0.0.1"], ] self.rpc_timeout = 120 diff --git a/test/functional/wallet_dump.py b/test/functional/wallet_dump.py index 098d375dff..a37a81c88e 100755 --- a/test/functional/wallet_dump.py +++ b/test/functional/wallet_dump.py @@ -79,7 +79,7 @@ def read_dump(file_name, addrs, script_addrs, hd_master_addr_old): class WalletDumpTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 - self.extra_args = [["-keypool=90", "-usehd=1", "-wallet=dump"]] + self.extra_args = [["-keypool=90", "-usehd=1"]] self.rpc_timeout = 120 def skip_test_if_missing_module(self): diff --git a/test/functional/wallet_import_rescan.py b/test/functional/wallet_import_rescan.py index 64d4deec0a..fa112926ed 100755 --- a/test/functional/wallet_import_rescan.py +++ b/test/functional/wallet_import_rescan.py @@ -125,7 +125,7 @@ class ImportRescanTest(BitcoinTestFramework): self.skip_if_no_wallet() def setup_network(self): - extra_args = [["-wallet="] for _ in range(self.num_nodes)] + extra_args = [[] for _ in range(self.num_nodes)] for i, import_node in enumerate(IMPORT_NODES, 2): if import_node.prune: # txindex is enabled by default in Dash and needs to be disabled for import-rescan.py @@ -134,7 +134,7 @@ class ImportRescanTest(BitcoinTestFramework): self.add_nodes(self.num_nodes, extra_args=extra_args) # Import keys with pruning disabled - self.start_nodes(extra_args=[["-wallet="]] * self.num_nodes) + self.start_nodes(extra_args=[[]] * self.num_nodes) for n in self.nodes: n.importprivkey(privkey=n.get_deterministic_priv_key().key, label='coinbase') self.stop_nodes() diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py index a39751d921..4abcf2e6d1 100755 --- a/test/functional/wallet_multiwallet.py +++ b/test/functional/wallet_multiwallet.py @@ -43,7 +43,6 @@ class MultiWalletTest(BitcoinTestFramework): self.setup_clean_chain = True self.num_nodes = 2 self.rpc_timeout = 120 - self.extra_args = [["-wallet="], ["-wallet="]] def skip_test_if_missing_module(self): self.skip_if_no_wallet() @@ -84,7 +83,7 @@ class MultiWalletTest(BitcoinTestFramework): os.rename(wallet_dir("wallet.dat"), wallet_dir("w8")) # create another dummy wallet for use in testing backups later - self.start_node(0, ["-wallet="]) + self.start_node(0, []) self.stop_nodes() empty_wallet = os.path.join(self.options.tmpdir, 'empty.dat') os.rename(wallet_dir("wallet.dat"), empty_wallet) @@ -161,7 +160,7 @@ class MultiWalletTest(BitcoinTestFramework): competing_wallet_dir = os.path.join(self.options.tmpdir, 'competing_walletdir') os.mkdir(competing_wallet_dir) - self.restart_node(0, ['-walletdir=' + competing_wallet_dir, '-wallet=']) + self.restart_node(0, ['-walletdir=' + competing_wallet_dir]) exp_stderr = r"Error: Error initializing wallet database environment \"\S+competing_walletdir\"!" self.nodes[1].assert_start_raises_init_error(['-walletdir=' + competing_wallet_dir], exp_stderr, match=ErrorMatch.PARTIAL_REGEX) diff --git a/test/functional/wallet_startup.py b/test/functional/wallet_startup.py index 7310252158..9de7457f17 100755 --- a/test/functional/wallet_startup.py +++ b/test/functional/wallet_startup.py @@ -26,16 +26,6 @@ class WalletStartupTest(BitcoinTestFramework): self.start_nodes() def run_test(self): - self.log.info('Should start without any wallets') - assert_equal(self.nodes[0].listwallets(), []) - assert_equal(self.nodes[0].listwalletdir(), {'wallets': []}) - - self.log.info('New default wallet should load by default when there are no other wallets') - self.nodes[0].createwallet(wallet_name='', load_on_startup=False) - self.restart_node(0) - assert_equal(self.nodes[0].listwallets(), ['']) - - self.log.info('Test load on startup behavior') self.nodes[0].createwallet(wallet_name='w0', load_on_startup=True) self.nodes[0].createwallet(wallet_name='w1', load_on_startup=False) self.nodes[0].createwallet(wallet_name='w2', load_on_startup=True)