Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/load.cpp
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | for (const auto &wallet_file : wallet_files) { | ||||
} | } | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
bool LoadWallets(const CChainParams &chainParams, interfaces::Chain &chain, | bool LoadWallets(const CChainParams &chainParams, interfaces::Chain &chain, | ||||
const std::vector<std::string> &wallet_files) { | const std::vector<std::string> &wallet_files) { | ||||
try { | |||||
for (const std::string &walletFile : wallet_files) { | for (const std::string &walletFile : wallet_files) { | ||||
bilingual_str error; | bilingual_str error; | ||||
std::vector<bilingual_str> warnings; | std::vector<bilingual_str> warnings; | ||||
std::shared_ptr<CWallet> pwallet = CWallet::CreateWalletFromFile( | std::shared_ptr<CWallet> pwallet = CWallet::CreateWalletFromFile( | ||||
chainParams, chain, WalletLocation(walletFile), error, warnings); | chainParams, chain, WalletLocation(walletFile), error, | ||||
warnings); | |||||
if (!warnings.empty()) { | if (!warnings.empty()) { | ||||
chain.initWarning(Join(warnings, Untranslated("\n"))); | chain.initWarning(Join(warnings, Untranslated("\n"))); | ||||
} | } | ||||
if (!pwallet) { | if (!pwallet) { | ||||
chain.initError(error); | chain.initError(error); | ||||
return false; | return false; | ||||
} | } | ||||
AddWallet(pwallet); | AddWallet(pwallet); | ||||
} | } | ||||
return true; | return true; | ||||
} catch (const std::runtime_error &e) { | |||||
chain.initError(Untranslated(e.what())); | |||||
return false; | |||||
} | |||||
} | } | ||||
void StartWallets(CScheduler &scheduler, const ArgsManager &args) { | void StartWallets(CScheduler &scheduler, const ArgsManager &args) { | ||||
for (const std::shared_ptr<CWallet> &pwallet : GetWallets()) { | for (const std::shared_ptr<CWallet> &pwallet : GetWallets()) { | ||||
pwallet->postInitProcess(); | pwallet->postInitProcess(); | ||||
} | } | ||||
// Schedule periodic wallet flushes and tx rebroadcasts | // Schedule periodic wallet flushes and tx rebroadcasts | ||||
Show All 37 Lines |