aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2020-07-16 13:19:37 -0400
committerAndrew Chow <achow101-github@achow101.com>2020-07-22 23:30:19 -0400
commit65fb8807ac402d1e924fd85969b5837c192bf59f (patch)
tree72f74723735ad8997103cc664cdc98ed6529d3d5
parent9d4b3d86b694ac6e56495e1955f6bf5ff584cbb9 (diff)
Combine BerkeleyEnvironment::Verify into BerkeleyDatabase::Verify
-rw-r--r--src/wallet/bdb.cpp17
-rw-r--r--src/wallet/bdb.h2
2 files changed, 6 insertions, 13 deletions
diff --git a/src/wallet/bdb.cpp b/src/wallet/bdb.cpp
index 1953be2d54..3c9d25e5a8 100644
--- a/src/wallet/bdb.cpp
+++ b/src/wallet/bdb.cpp
@@ -232,16 +232,6 @@ BerkeleyEnvironment::BerkeleyEnvironment()
fMockDb = true;
}
-bool BerkeleyEnvironment::Verify(const std::string& strFile)
-{
- LOCK(cs_db);
- assert(mapFileUseCount.count(strFile) == 0);
-
- Db db(dbenv.get(), 0);
- int result = db.verify(strFile.c_str(), nullptr, nullptr, 0);
- return result == 0;
-}
-
BerkeleyBatch::SafeDbt::SafeDbt()
{
m_dbt.set_flags(DB_DBT_MALLOC);
@@ -295,7 +285,12 @@ bool BerkeleyDatabase::Verify(bilingual_str& errorStr)
if (fs::exists(file_path))
{
- if (!env->Verify(strFile)) {
+ LOCK(cs_db);
+ assert(env->mapFileUseCount.count(strFile) == 0);
+
+ Db db(env->dbenv.get(), 0);
+ int result = db.verify(strFile.c_str(), nullptr, nullptr, 0);
+ if (result != 0) {
errorStr = strprintf(_("%s corrupt. Try using the wallet tool bitcoin-wallet to salvage or restoring a backup."), file_path);
return false;
}
diff --git a/src/wallet/bdb.h b/src/wallet/bdb.h
index ef3b81d4d6..3068a75c5d 100644
--- a/src/wallet/bdb.h
+++ b/src/wallet/bdb.h
@@ -67,8 +67,6 @@ public:
bool IsDatabaseLoaded(const std::string& db_filename) const { return m_databases.find(db_filename) != m_databases.end(); }
fs::path Directory() const { return strPath; }
- bool Verify(const std::string& strFile);
-
bool Open(bilingual_str& error);
void Close();
void Flush(bool fShutdown);