File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed
Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -232,16 +232,6 @@ BerkeleyEnvironment::BerkeleyEnvironment()
232232 fMockDb = true ;
233233}
234234
235- bool BerkeleyEnvironment::Verify (const std::string& strFile)
236- {
237- LOCK (cs_db);
238- assert (mapFileUseCount.count (strFile) == 0 );
239-
240- Db db (dbenv.get (), 0 );
241- int result = db.verify (strFile.c_str (), nullptr , nullptr , 0 );
242- return result == 0 ;
243- }
244-
245235BerkeleyBatch::SafeDbt::SafeDbt ()
246236{
247237 m_dbt.set_flags (DB_DBT_MALLOC);
@@ -295,7 +285,12 @@ bool BerkeleyDatabase::Verify(bilingual_str& errorStr)
295285
296286 if (fs::exists (file_path))
297287 {
298- if (!env->Verify (strFile)) {
288+ LOCK (cs_db);
289+ assert (env->mapFileUseCount .count (strFile) == 0 );
290+
291+ Db db (env->dbenv .get (), 0 );
292+ int result = db.verify (strFile.c_str (), nullptr , nullptr , 0 );
293+ if (result != 0 ) {
299294 errorStr = strprintf (_ (" %s corrupt. Try using the wallet tool bitcoin-wallet to salvage or restoring a backup." ), file_path);
300295 return false ;
301296 }
Original file line number Diff line number Diff line change @@ -67,8 +67,6 @@ class BerkeleyEnvironment
6767 bool IsDatabaseLoaded (const std::string& db_filename) const { return m_databases.find (db_filename) != m_databases.end (); }
6868 fs::path Directory () const { return strPath; }
6969
70- bool Verify (const std::string& strFile);
71-
7270 bool Open (bilingual_str& error);
7371 void Close ();
7472 void Flush (bool fShutdown );
You can’t perform that action at this time.
0 commit comments