Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | CreateWallet(interfaces::Chain &chain, const std::string &name, | ||||
// blank to make it encrypted | // blank to make it encrypted | ||||
bool create_blank = (wallet_creation_flags & WALLET_FLAG_BLANK_WALLET); | bool create_blank = (wallet_creation_flags & WALLET_FLAG_BLANK_WALLET); | ||||
// Born encrypted wallets need to be created blank first. | // Born encrypted wallets need to be created blank first. | ||||
if (!passphrase.empty()) { | if (!passphrase.empty()) { | ||||
wallet_creation_flags |= WALLET_FLAG_BLANK_WALLET; | 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 | // Wallet::Verify will check if we're trying to create a wallet with a | ||||
// duplicate name. | // duplicate name. | ||||
std::unique_ptr<WalletDatabase> database = | std::unique_ptr<WalletDatabase> database = | ||||
MakeWalletDatabase(name, options, status, error); | MakeWalletDatabase(name, options, status, error); | ||||
if (!database) { | if (!database) { | ||||
error = Untranslated("Wallet file verification failed.") + | error = Untranslated("Wallet file verification failed.") + | ||||
Untranslated(" ") + error; | Untranslated(" ") + error; | ||||
status = DatabaseStatus::FAILED_VERIFY; | status = DatabaseStatus::FAILED_VERIFY; | ||||
▲ Show 20 Lines • Show All 4,787 Lines • Show Last 20 Lines |