Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | |||||
static const size_t OUTPUT_GROUP_MAX_ENTRIES = 10; | static const size_t OUTPUT_GROUP_MAX_ENTRIES = 10; | ||||
std::shared_ptr<CWallet> LoadWallet(const CChainParams &chainParams, | std::shared_ptr<CWallet> LoadWallet(const CChainParams &chainParams, | ||||
interfaces::Chain &chain, | interfaces::Chain &chain, | ||||
const WalletLocation &location, | const WalletLocation &location, | ||||
bilingual_str &error, | bilingual_str &error, | ||||
std::vector<bilingual_str> &warnings) { | std::vector<bilingual_str> &warnings) { | ||||
try { | |||||
if (!CWallet::Verify(chainParams, chain, location, error, warnings)) { | if (!CWallet::Verify(chainParams, chain, location, error, warnings)) { | ||||
error = Untranslated("Wallet file verification failed.") + | error = Untranslated("Wallet file verification failed.") + | ||||
Untranslated(" ") + error; | Untranslated(" ") + error; | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
std::shared_ptr<CWallet> wallet = CWallet::CreateWalletFromFile( | std::shared_ptr<CWallet> wallet = CWallet::CreateWalletFromFile( | ||||
chainParams, chain, location, error, warnings); | chainParams, chain, location, error, warnings); | ||||
if (!wallet) { | if (!wallet) { | ||||
error = | error = Untranslated("Wallet loading failed.") + Untranslated(" ") + | ||||
Untranslated("Wallet loading failed.") + Untranslated(" ") + error; | error; | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
AddWallet(wallet); | AddWallet(wallet); | ||||
wallet->postInitProcess(); | wallet->postInitProcess(); | ||||
return wallet; | return wallet; | ||||
} catch (const std::runtime_error &e) { | |||||
error = Untranslated(e.what()); | |||||
return nullptr; | |||||
} | |||||
} | } | ||||
std::shared_ptr<CWallet> LoadWallet(const CChainParams &chainParams, | std::shared_ptr<CWallet> LoadWallet(const CChainParams &chainParams, | ||||
interfaces::Chain &chain, | interfaces::Chain &chain, | ||||
const std::string &name, | const std::string &name, | ||||
bilingual_str &error, | bilingual_str &error, | ||||
std::vector<bilingual_str> &warnings) { | std::vector<bilingual_str> &warnings) { | ||||
return LoadWallet(chainParams, chain, WalletLocation(name), error, | return LoadWallet(chainParams, chain, WalletLocation(name), error, | ||||
▲ Show 20 Lines • Show All 4,867 Lines • Show Last 20 Lines |