Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 4,138 Lines • ▼ Show 20 Lines | bool CWallet::Verify(const CChainParams &chainParams, interfaces::Chain &chain, | ||||
} | } | ||||
// Keep same database environment instance across Verify/Recover calls | // Keep same database environment instance across Verify/Recover calls | ||||
// below. | // below. | ||||
std::unique_ptr<WalletDatabase> database = | std::unique_ptr<WalletDatabase> database = | ||||
WalletDatabase::Create(wallet_path); | WalletDatabase::Create(wallet_path); | ||||
try { | try { | ||||
if (!WalletBatch::VerifyEnvironment(wallet_path, error_string)) { | return database->Verify(error_string); | ||||
return false; | |||||
} | |||||
} catch (const fs::filesystem_error &e) { | } catch (const fs::filesystem_error &e) { | ||||
error_string = Untranslated( | error_string = Untranslated( | ||||
strprintf("Error loading wallet %s. %s", location.GetName(), | strprintf("Error loading wallet %s. %s", location.GetName(), | ||||
fsbridge::get_filesystem_error_message(e))); | fsbridge::get_filesystem_error_message(e))); | ||||
return false; | return false; | ||||
} | } | ||||
return WalletBatch::VerifyDatabaseFile(wallet_path, error_string); | |||||
} | } | ||||
std::shared_ptr<CWallet> CWallet::CreateWalletFromFile( | std::shared_ptr<CWallet> CWallet::CreateWalletFromFile( | ||||
const CChainParams &chainParams, interfaces::Chain &chain, | const CChainParams &chainParams, interfaces::Chain &chain, | ||||
const WalletLocation &location, bilingual_str &error, | const WalletLocation &location, bilingual_str &error, | ||||
std::vector<bilingual_str> &warnings, uint64_t wallet_creation_flags) { | std::vector<bilingual_str> &warnings, uint64_t wallet_creation_flags) { | ||||
const std::string walletFile = | const std::string walletFile = | ||||
WalletDataFilePath(location.GetPath()).string(); | WalletDataFilePath(location.GetPath()).string(); | ||||
▲ Show 20 Lines • Show All 881 Lines • Show Last 20 Lines |