22 fs::path wallet_dir =
gArgs.
GetArg(
"-walletdir",
"");
23 boost::system::error_code
error;
25 fs::path canonical_wallet_dir = fs::canonical(wallet_dir,
error);
26 if (
error || !fs::exists(wallet_dir)) {
27 chain.
initError(
strprintf(
_(
"Specified -walletdir \"%s\" does not exist"), wallet_dir.string()));
29 }
else if (!fs::is_directory(wallet_dir)) {
30 chain.
initError(
strprintf(
_(
"Specified -walletdir \"%s\" is not a directory"), wallet_dir.string()));
33 }
else if (!wallet_dir.is_absolute()) {
34 chain.
initError(
strprintf(
_(
"Specified -walletdir \"%s\" is a relative path"), wallet_dir.string()));
42 chain.
initMessage(
_(
"Verifying wallet(s)…").translated);
62 std::set<fs::path> wallet_paths;
64 for (
const auto& wallet_file :
gArgs.
GetArgs(
"-wallet")) {
67 if (!wallet_paths.insert(path).second) {
93 std::set<fs::path> wallet_paths;
95 if (!wallet_paths.insert(
name).second) {
103 std::vector<bilingual_str> warnings;
118 }
catch (
const std::runtime_error& e) {
126 for (
const std::shared_ptr<CWallet>& pwallet :
GetWallets()) {
127 pwallet->postInitProcess();
139 for (
const std::shared_ptr<CWallet>& pwallet :
GetWallets()) {
146 for (
const std::shared_ptr<CWallet>& pwallet :
GetWallets()) {
154 while (!wallets.empty()) {
155 auto wallet = wallets.back();
157 std::vector<bilingual_str> warnings;
std::map< std::string, SettingsValue > rw_settings
Map of setting name to read-write file setting value.
static std::shared_ptr< CWallet > Create(interfaces::Chain *chain, const std::string &name, std::unique_ptr< WalletDatabase > database, uint64_t wallet_creation_flags, bilingual_str &error, std::vector< bilingual_str > &warnings)
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
fs::path AbsPathJoin(const fs::path &base, const fs::path &path)
Helper function for joining two paths.
bool RemoveWallet(const std::shared_ptr< CWallet > &wallet, std::optional< bool > load_on_start, std::vector< bilingual_str > &warnings)
bool LoadWallets(interfaces::Chain &chain)
Load wallet databases.
void scheduleEvery(Function f, std::chrono::milliseconds delta)
Repeat f until the scheduler is stopped.
auto Join(const std::vector< T > &list, const BaseType &separator, UnaryOp unary_op) -> decltype(unary_op(list.at(0)))
Join a list of items.
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
void ForceSetArg(const std::string &strArg, const std::string &strValue)
void StopWallets()
Stop all wallets. Wallets will be flushed first.
bool VerifyWallets(interfaces::Chain &chain)
Responsible for reading and validating the -wallet arguments and verifying the wallet database...
bool push_back(const UniValue &val)
fs::path GetWalletDir()
Get the path of the wallet directory.
bilingual_str _(const char *psz)
Translation function.
bool AddWallet(const std::shared_ptr< CWallet > &wallet)
void MaybeCompactWalletDB()
Compacts BDB state so that wallet.dat is self-contained (if there are changes)
void UnloadWallet(std::shared_ptr< CWallet > &&wallet)
Explicitly unload and delete the wallet.
void FlushWallets()
Flush all wallets in preparation for shutdown.
virtual void initWarning(const bilingual_str &message)=0
Send init warning.
std::vector< std::shared_ptr< CWallet > > GetWallets()
void MaybeResendWalletTxs()
Called periodically by the schedule thread.
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
static const bool DEFAULT_FLUSHWALLET
Overview of wallet database classes:
virtual void initMessage(const std::string &message)=0
Send init message.
void UnloadWallets()
Close all wallets.
Simple class for background tasks that should be run periodically or once "after a while"...
void LockSettings(Fn &&fn)
Access settings with lock held.
std::vector< std::string > GetArgs(const std::string &strArg) const
Return a vector of strings of the given argument.
std::unique_ptr< WalletDatabase > MakeWalletDatabase(const std::string &name, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error_string)
virtual void initError(const bilingual_str &message)=0
Send init error.
bool error(const char *fmt, const Args &... args)
void StartWallets(CScheduler &scheduler, const ArgsManager &args)
Complete startup of wallets.