diff options
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/init.cpp | 2 | ||||
-rw-r--r-- | src/wallet/load.cpp | 13 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 5d8c4fba29..8b2ef191fb 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -60,7 +60,7 @@ void WalletInit::AddWalletOptions(ArgsManager& argsman) const argsman.AddArg("-rescan", "Rescan the block chain for missing wallet transactions on startup", 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("-txconfirmtarget=<n>", strprintf("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)", DEFAULT_TX_CONFIRM_TARGET), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); - argsman.AddArg("-wallet=<path>", "Specify wallet database path. Can be specified multiple times to load multiple wallets. Path is interpreted relative to <walletdir> 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 <walletdir>.)", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::WALLET); + argsman.AddArg("-wallet=<path>", "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 <walletdir>. 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 <walletdir>.", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::WALLET); argsman.AddArg("-walletbroadcast", strprintf("Make the wallet broadcast transactions (default: %u)", DEFAULT_WALLETBROADCAST), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); argsman.AddArg("-walletdir=<dir>", "Specify directory to hold wallets (default: <datadir>/wallets if it exists, otherwise <datadir>)", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::WALLET); #if HAVE_SYSTEM diff --git a/src/wallet/load.cpp b/src/wallet/load.cpp index 1b057000d2..1cdcb35fc7 100644 --- a/src/wallet/load.cpp +++ b/src/wallet/load.cpp @@ -71,11 +71,16 @@ 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)) { - chain.initError(error_string); - return false; + 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; + } } } @@ -88,10 +93,14 @@ 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; std::vector<bilingual_str> warnings; std::unique_ptr<WalletDatabase> database = MakeWalletDatabase(name, options, status, error); + if (!database && status == DatabaseStatus::FAILED_NOT_FOUND) { + continue; + } std::shared_ptr<CWallet> pwallet = database ? CWallet::Create(chain, name, std::move(database), options.create_flags, error, warnings) : nullptr; if (!warnings.empty()) chain.initWarning(Join(warnings, Untranslated("\n"))); if (!pwallet) { |