Skip to content

Commit 07250b8

Browse files
committed
walletdb: remove fAggressive from Salvage
The only call to Salvage set fAggressive = true so remove that parameter and always use DB_AGGRESSIVE
1 parent 8ebcbc8 commit 07250b8

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/wallet/db.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ bool BerkeleyBatch::Recover(const fs::path& file_path, void *callbackDataIn, boo
343343
}
344344

345345
std::vector<BerkeleyEnvironment::KeyValPair> salvagedData;
346-
bool fSuccess = env->Salvage(newFilename, true, salvagedData);
346+
bool fSuccess = env->Salvage(newFilename, salvagedData);
347347
if (salvagedData.empty())
348348
{
349349
LogPrintf("Salvage(aggressive) found no records in %s.\n", newFilename);
@@ -425,25 +425,17 @@ static const char *HEADER_END = "HEADER=END";
425425
/* End of key/value data */
426426
static const char *DATA_END = "DATA=END";
427427

428-
bool BerkeleyEnvironment::Salvage(const std::string& strFile, bool fAggressive, std::vector<BerkeleyEnvironment::KeyValPair>& vResult)
428+
bool BerkeleyEnvironment::Salvage(const std::string& strFile, std::vector<BerkeleyEnvironment::KeyValPair>& vResult)
429429
{
430430
LOCK(cs_db);
431431
assert(mapFileUseCount.count(strFile) == 0);
432432

433-
u_int32_t flags = DB_SALVAGE;
434-
if (fAggressive)
435-
flags |= DB_AGGRESSIVE;
436-
437433
std::stringstream strDump;
438434

439435
Db db(dbenv.get(), 0);
440-
int result = db.verify(strFile.c_str(), nullptr, &strDump, flags);
436+
int result = db.verify(strFile.c_str(), nullptr, &strDump, DB_SALVAGE | DB_AGGRESSIVE);
441437
if (result == DB_VERIFY_BAD) {
442438
LogPrintf("BerkeleyEnvironment::Salvage: Database salvage found errors, all data may not be recoverable.\n");
443-
if (!fAggressive) {
444-
LogPrintf("BerkeleyEnvironment::Salvage: Rerun with aggressive mode to ignore errors and continue.\n");
445-
return false;
446-
}
447439
}
448440
if (result != 0 && result != DB_VERIFY_BAD) {
449441
LogPrintf("BerkeleyEnvironment::Salvage: Database salvage failed with result %d.\n", result);

src/wallet/db.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class BerkeleyEnvironment
7575
* for huge databases.
7676
*/
7777
typedef std::pair<std::vector<unsigned char>, std::vector<unsigned char> > KeyValPair;
78-
bool Salvage(const std::string& strFile, bool fAggressive, std::vector<KeyValPair>& vResult);
78+
bool Salvage(const std::string& strFile, std::vector<KeyValPair>& vResult);
7979

8080
bool Open(bool retry);
8181
void Close();

0 commit comments

Comments
 (0)