Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/init.cpp
Show First 20 Lines • Show All 377 Lines • ▼ Show 20 Lines | bool WalletInit::Open(const CChainParams &chainParams) const { | ||||
} | } | ||||
for (const std::string &walletFile : gArgs.GetArgs("-wallet")) { | for (const std::string &walletFile : gArgs.GetArgs("-wallet")) { | ||||
CWallet *const pwallet = CWallet::CreateWalletFromFile( | CWallet *const pwallet = CWallet::CreateWalletFromFile( | ||||
chainParams, walletFile, fs::absolute(walletFile, GetWalletDir())); | chainParams, walletFile, fs::absolute(walletFile, GetWalletDir())); | ||||
if (!pwallet) { | if (!pwallet) { | ||||
return false; | return false; | ||||
} | } | ||||
vpwallets.push_back(pwallet); | AddWallet(pwallet); | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
void WalletInit::Start(CScheduler &scheduler) const { | void WalletInit::Start(CScheduler &scheduler) const { | ||||
for (CWallet *pwallet : vpwallets) { | for (CWallet *pwallet : GetWallets()) { | ||||
pwallet->postInitProcess(scheduler); | pwallet->postInitProcess(scheduler); | ||||
} | } | ||||
} | } | ||||
void WalletInit::Flush() const { | void WalletInit::Flush() const { | ||||
for (CWallet *pwallet : vpwallets) { | for (CWallet *pwallet : GetWallets()) { | ||||
pwallet->Flush(false); | pwallet->Flush(false); | ||||
} | } | ||||
} | } | ||||
void WalletInit::Stop() const { | void WalletInit::Stop() const { | ||||
for (CWallet *pwallet : vpwallets) { | for (CWallet *pwallet : GetWallets()) { | ||||
pwallet->Flush(true); | pwallet->Flush(true); | ||||
} | } | ||||
} | } | ||||
void WalletInit::Close() const { | void WalletInit::Close() const { | ||||
for (CWallet *pwallet : vpwallets) { | for (CWallet *pwallet : GetWallets()) { | ||||
RemoveWallet(pwallet); | |||||
delete pwallet; | delete pwallet; | ||||
} | } | ||||
vpwallets.clear(); | |||||
} | } |