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()
232
232
fMockDb = true ;
233
233
}
234
234
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
-
245
235
BerkeleyBatch::SafeDbt::SafeDbt ()
246
236
{
247
237
m_dbt.set_flags (DB_DBT_MALLOC);
@@ -295,7 +285,12 @@ bool BerkeleyDatabase::Verify(bilingual_str& errorStr)
295
285
296
286
if (fs::exists (file_path))
297
287
{
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 ) {
299
294
errorStr = strprintf (_ (" %s corrupt. Try using the wallet tool bitcoin-wallet to salvage or restoring a backup." ), file_path);
300
295
return false ;
301
296
}
Original file line number Diff line number Diff line change @@ -67,8 +67,6 @@ class BerkeleyEnvironment
67
67
bool IsDatabaseLoaded (const std::string& db_filename) const { return m_databases.find (db_filename) != m_databases.end (); }
68
68
fs::path Directory () const { return strPath; }
69
69
70
- bool Verify (const std::string& strFile);
71
-
72
70
bool Open (bilingual_str& error);
73
71
void Close ();
74
72
void Flush (bool fShutdown );
You can’t perform that action at this time.
0 commit comments