diff --git a/src/wallet/db.h b/src/wallet/db.h --- a/src/wallet/db.h +++ b/src/wallet/db.h @@ -72,8 +72,7 @@ * for huge databases. */ typedef std::pair, std::vector> KeyValPair; - bool Salvage(const std::string &strFile, bool fAggressive, - std::vector &vResult); + bool Salvage(const std::string &strFile, std::vector &vResult); bool Open(bool retry); void Close(); diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -365,7 +365,7 @@ } std::vector salvagedData; - bool fSuccess = env->Salvage(newFilename, true, salvagedData); + bool fSuccess = env->Salvage(newFilename, salvagedData); if (salvagedData.empty()) { LogPrintf("Salvage(aggressive) found no records in %s.\n", newFilename); return false; @@ -453,28 +453,19 @@ static const char *DATA_END = "DATA=END"; bool BerkeleyEnvironment::Salvage( - const std::string &strFile, bool fAggressive, + const std::string &strFile, std::vector &vResult) { LOCK(cs_db); assert(mapFileUseCount.count(strFile) == 0); - u_int32_t flags = DB_SALVAGE; - if (fAggressive) { - flags |= DB_AGGRESSIVE; - } - std::stringstream strDump; Db db(dbenv.get(), 0); - int result = db.verify(strFile.c_str(), nullptr, &strDump, flags); + int result = db.verify(strFile.c_str(), nullptr, &strDump, + DB_SALVAGE | DB_AGGRESSIVE); if (result == DB_VERIFY_BAD) { LogPrintf("BerkeleyEnvironment::Salvage: Database salvage found " "errors, all data may not be recoverable.\n"); - if (!fAggressive) { - LogPrintf("BerkeleyEnvironment::Salvage: Rerun with aggressive " - "mode to ignore errors and continue.\n"); - return false; - } } if (result != 0 && result != DB_VERIFY_BAD) { LogPrintf("BerkeleyEnvironment::Salvage: Database salvage failed with "