mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 11:57:28 -03:00
wallet: Remove path checking code from createwallet RPC
This commit does not change behavior except for error messages which now include more complete information.
This commit is contained in:
parent
a987438e9d
commit
77d5bb72b8
3 changed files with 3 additions and 8 deletions
|
@ -2647,6 +2647,7 @@ static UniValue createwallet(const JSONRPCRequest& request)
|
|||
|
||||
DatabaseOptions options;
|
||||
DatabaseStatus status;
|
||||
options.require_create = true;
|
||||
options.create_flags = flags;
|
||||
options.create_passphrase = passphrase;
|
||||
bilingual_str error;
|
||||
|
|
|
@ -253,13 +253,6 @@ std::shared_ptr<CWallet> CreateWallet(interfaces::Chain& chain, const std::strin
|
|||
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<WalletDatabase> database = MakeWalletDatabase(name, options, status, error);
|
||||
if (!database) {
|
||||
|
|
|
@ -273,7 +273,8 @@ class MultiWalletTest(BitcoinTestFramework):
|
|||
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, "Failed to create database path '{}'. Database already exists.".format(path), self.nodes[0].createwallet, 'w2')
|
||||
|
||||
# Successfully create a wallet with a new name
|
||||
loadwallet_name = self.nodes[0].createwallet('w9')
|
||||
|
|
Loading…
Reference in a new issue