MCPcopy Create free account
hub / github.com/ElementsProject/elements / Verify

Method Verify

src/wallet/bdb.cpp:260–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260bool BerkeleyDatabase::Verify(bilingual_str& errorStr)
261{
262 fs::path walletDir = env->Directory();
263 fs::path file_path = walletDir / strFile;
264
265 LogPrintf("Using BerkeleyDB version %s\n", BerkeleyDatabaseVersion());
266 LogPrintf("Using wallet %s\n", fs::PathToString(file_path));
267
268 if (!env->Open(errorStr)) {
269 return false;
270 }
271
272 if (fs::exists(file_path))
273 {
274 assert(m_refcount == 0);
275
276 Db db(env->dbenv.get(), 0);
277 int result = db.verify(strFile.c_str(), nullptr, nullptr, 0);
278 if (result != 0) {
279 errorStr = strprintf(_("%s corrupt. Try using the wallet tool bitcoin-wallet to salvage or restoring a backup."), fs::quoted(fs::PathToString(file_path)));
280 return false;
281 }
282 }
283 // also return true if files does not exists
284 return true;
285}
286
287void BerkeleyEnvironment::CheckpointLSN(const std::string& strFile)
288{

Callers 6

MakeBerkeleyDatabaseFunction · 0.45
EvalScriptFunction · 0.45
VerifyECDSASignatureMethod · 0.45
CheckECDSASignatureMethod · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
FUZZ_TARGET_INITFunction · 0.45

Calls 9

BerkeleyDatabaseVersionFunction · 0.85
PathToStringFunction · 0.85
existsFunction · 0.85
_Function · 0.85
quotedFunction · 0.85
DirectoryMethod · 0.80
OpenMethod · 0.45
getMethod · 0.45
verifyMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.36
FUZZ_TARGET_INITFunction · 0.36