Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/load.cpp
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | for (const auto &wallet_file : wallet_files) { | ||||
if (!wallet_paths.insert(location.GetPath()).second) { | if (!wallet_paths.insert(location.GetPath()).second) { | ||||
chain.initError(strprintf(_("Error loading wallet %s. Duplicate " | chain.initError(strprintf(_("Error loading wallet %s. Duplicate " | ||||
"-wallet filename specified.") | "-wallet filename specified.") | ||||
.translated, | .translated, | ||||
wallet_file)); | wallet_file)); | ||||
return false; | return false; | ||||
} | } | ||||
std::string error_string; | bilingual_str error_string; | ||||
std::vector<std::string> warnings; | std::vector<bilingual_str> warnings; | ||||
bool verify_success = | bool verify_success = | ||||
CWallet::Verify(chainParams, chain, location, salvage_wallet, | CWallet::Verify(chainParams, chain, location, salvage_wallet, | ||||
error_string, warnings); | error_string, warnings); | ||||
if (!error_string.empty()) { | |||||
chain.initError(error_string); | |||||
} | |||||
if (!warnings.empty()) { | if (!warnings.empty()) { | ||||
chain.initWarning(Join(warnings, "\n")); | chain.initWarning(Join(warnings, "\n", OpTranslated)); | ||||
} | } | ||||
if (!verify_success) { | if (!verify_success) { | ||||
chain.initError(error_string.translated); | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
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) { | ||||
for (const std::string &walletFile : wallet_files) { | for (const std::string &walletFile : wallet_files) { | ||||
std::string error; | bilingual_str error; | ||||
std::vector<std::string> 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, "\n")); | chain.initWarning(Join(warnings, "\n", OpTranslated)); | ||||
} | } | ||||
if (!pwallet) { | if (!pwallet) { | ||||
chain.initError(error); | chain.initError(error.translated); | ||||
return false; | return false; | ||||
} | } | ||||
AddWallet(pwallet); | AddWallet(pwallet); | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |