diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3314,6 +3314,7 @@ DatabaseOptions options; DatabaseStatus status; + options.require_create = true; options.create_flags = flags; options.create_passphrase = passphrase; bilingual_str error; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -291,15 +291,6 @@ wallet_creation_flags |= WALLET_FLAG_BLANK_WALLET; } - // Check the wallet file location - if (fs::symlink_status( - fs::absolute(name.empty() ? "wallet.dat" : name, GetWalletDir())) - .type() != fs::file_not_found) { - error = strprintf(Untranslated("Wallet %s already exists."), name); - status = DatabaseStatus::FAILED_CREATE; - return nullptr; - } - // Wallet::Verify will check if we're trying to create a wallet with a // duplicate name. std::unique_ptr database = diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py --- a/test/functional/wallet_multiwallet.py +++ b/test/functional/wallet_multiwallet.py @@ -348,8 +348,12 @@ self.log.info("Test dynamic wallet creation.") # Fail to create a wallet if it already exists. - assert_raises_rpc_error(-4, "Wallet w2 already exists.", - self.nodes[0].createwallet, 'w2') + path = os.path.join(self.options.tmpdir, "node0", "regtest", + "wallets", "w2") + assert_raises_rpc_error( + -4, + f"Failed to create database path '{path}'. Database already exists.", + self.nodes[0].createwallet, 'w2') # Successfully create a wallet with a new name loadwallet_name = self.nodes[0].createwallet('w9')