aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2020-05-15 18:48:33 -0400
committerAndrew Chow <achow101-github@achow101.com>2020-05-25 12:59:29 -0400
commit07250b8dcebe2b97ed0fd900ad35cba4091b8ecf (patch)
tree29ce903b15ace19b83fd55bfd3d8d8b9d33cc75c
parent8ebcbc85c652665b78dcfd2ad55fa67cafd42c73 (diff)
walletdb: remove fAggressive from Salvage
The only call to Salvage set fAggressive = true so remove that parameter and always use DB_AGGRESSIVE
-rw-r--r--src/wallet/db.cpp14
-rw-r--r--src/wallet/db.h2
2 files changed, 4 insertions, 12 deletions
diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp
index 34babd2681..c51401c102 100644
--- a/src/wallet/db.cpp
+++ b/src/wallet/db.cpp
@@ -343,7 +343,7 @@ bool BerkeleyBatch::Recover(const fs::path& file_path, void *callbackDataIn, boo
}
std::vector<BerkeleyEnvironment::KeyValPair> 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);
@@ -425,25 +425,17 @@ static const char *HEADER_END = "HEADER=END";
/* End of key/value data */
static const char *DATA_END = "DATA=END";
-bool BerkeleyEnvironment::Salvage(const std::string& strFile, bool fAggressive, std::vector<BerkeleyEnvironment::KeyValPair>& vResult)
+bool BerkeleyEnvironment::Salvage(const std::string& strFile, std::vector<BerkeleyEnvironment::KeyValPair>& 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 result %d.\n", result);
diff --git a/src/wallet/db.h b/src/wallet/db.h
index 1151124da3..4543c8c7e0 100644
--- a/src/wallet/db.h
+++ b/src/wallet/db.h
@@ -75,7 +75,7 @@ public:
* for huge databases.
*/
typedef std::pair<std::vector<unsigned char>, std::vector<unsigned char> > KeyValPair;
- bool Salvage(const std::string& strFile, bool fAggressive, std::vector<KeyValPair>& vResult);
+ bool Salvage(const std::string& strFile, std::vector<KeyValPair>& vResult);
bool Open(bool retry);
void Close();