Make explicitly requested salvage operations keep going when there is an error.

In my tests corrupted wallets would often result in BDB dropping an error
just due to duplicate records being found, which appears harmless.
This commit is contained in:
Gregory Maxwell 2013-03-24 12:59:03 -07:00
parent dfd71bb450
commit 14c9d116be

View file

@ -167,9 +167,18 @@ bool CDBEnv::Salvage(std::string strFile, bool fAggressive,
Db db(&dbenv, 0);
int result = db.verify(strFile.c_str(), NULL, &strDump, flags);
if (result != 0)
if (result == DB_VERIFY_BAD)
{
printf("ERROR: db salvage failed\n");
printf("Error: Salvage found errors, all data may not be recoverable.\n");
if (!fAggressive)
{
printf("Error: Rerun with aggressive mode to ignore errors and continue.\n");
return false;
}
}
if (result != 0 && result != DB_VERIFY_BAD)
{
printf("ERROR: db salvage failed: %d\n",result);
return false;
}