mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 23:09:44 -04:00
Ignoring (but warn) on duplicate -wallet parameters
This commit is contained in:
parent
218fe60d91
commit
58cfbc38e0
2 changed files with 8 additions and 4 deletions
|
@ -65,8 +65,8 @@ bool VerifyWallets(interfaces::Chain& chain)
|
||||||
const fs::path path = fs::absolute(wallet_file, GetWalletDir());
|
const fs::path path = fs::absolute(wallet_file, GetWalletDir());
|
||||||
|
|
||||||
if (!wallet_paths.insert(path).second) {
|
if (!wallet_paths.insert(path).second) {
|
||||||
chain.initError(strprintf(_("Error loading wallet %s. Duplicate -wallet filename specified."), wallet_file));
|
chain.initWarning(strprintf(_("Ignoring duplicate -wallet %s."), wallet_file));
|
||||||
return false;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseOptions options;
|
DatabaseOptions options;
|
||||||
|
@ -90,7 +90,11 @@ bool VerifyWallets(interfaces::Chain& chain)
|
||||||
bool LoadWallets(interfaces::Chain& chain)
|
bool LoadWallets(interfaces::Chain& chain)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
std::set<fs::path> wallet_paths;
|
||||||
for (const std::string& name : gArgs.GetArgs("-wallet")) {
|
for (const std::string& name : gArgs.GetArgs("-wallet")) {
|
||||||
|
if (!wallet_paths.insert(name).second) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
DatabaseOptions options;
|
DatabaseOptions options;
|
||||||
DatabaseStatus status;
|
DatabaseStatus status;
|
||||||
options.require_existing = true;
|
options.require_existing = true;
|
||||||
|
|
|
@ -134,8 +134,8 @@ class MultiWalletTest(BitcoinTestFramework):
|
||||||
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=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())
|
self.nodes[0].assert_start_raises_init_error(['-walletdir=debug.log'], 'Error: Specified -walletdir "debug.log" is not a directory', cwd=data_dir())
|
||||||
|
|
||||||
# should not initialize if there are duplicate wallets
|
self.start_node(0, ['-wallet=w1', '-wallet=w1'])
|
||||||
self.nodes[0].assert_start_raises_init_error(['-wallet=w1', '-wallet=w1'], 'Error: Error loading wallet w1. Duplicate -wallet filename specified.')
|
self.stop_node(0, 'Warning: Ignoring duplicate -wallet w1.')
|
||||||
|
|
||||||
if not self.options.descriptors:
|
if not self.options.descriptors:
|
||||||
# Only BDB doesn't open duplicate wallet files. SQLite does not have this limitation. While this may be desired in the future, it is not necessary
|
# Only BDB doesn't open duplicate wallet files. SQLite does not have this limitation. While this may be desired in the future, it is not necessary
|
||||||
|
|
Loading…
Add table
Reference in a new issue