MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / VerifyEnvironment

Method VerifyEnvironment

src/wallet/db.cpp:319–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319bool BerkeleyBatch::VerifyEnvironment(const fs::path& file_path, std::string& errorStr)
320{
321 std::string walletFile;
322 BerkeleyEnvironment* env = GetWalletEnv(file_path, walletFile);
323 fs::path walletDir = env->Directory();
324
325 LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(0, 0, 0));
326 LogPrintf("Using wallet %s\n", walletFile);
327
328 // Wallet file must be a plain filename without a directory
329 if (walletFile != fs::basename(walletFile) + fs::extension(walletFile))
330 {
331 errorStr = strprintf(_("Wallet %s resides outside wallet directory %s"), walletFile, walletDir.string());
332 return false;
333 }
334
335 if (!env->Open(true /* retry */)) {
336 errorStr = strprintf(_("Error initializing wallet database environment %s!"), walletDir);
337 return false;
338 }
339
340 return true;
341}
342
343bool BerkeleyBatch::VerifyDatabaseFile(const fs::path& file_path, std::string& warningStr, std::string& errorStr, BerkeleyEnvironment::recoverFunc_type recoverFunc)
344{

Callers

nothing calls this directly

Calls 4

GetWalletEnvFunction · 0.85
_Function · 0.85
DirectoryMethod · 0.80
OpenMethod · 0.45

Tested by

no test coverage detected