Skip to content

Commit

Permalink
optional aggressiveness of salvagewallet
Browse files Browse the repository at this point in the history
  • Loading branch information
backpacker69 committed Aug 5, 2019
1 parent ebd6f25 commit ce19110
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/wallet/db.cpp
Expand Up @@ -236,13 +236,14 @@ bool CDB::Recover(const std::string& filename, void *callbackDataIn, bool (*reco
}

std::vector<CDBEnv::KeyValPair> salvagedData;
bool fSuccess = bitdb.Salvage(newFilename, true, salvagedData);
bool fAggressive = gArgs.GetBoolArg("-salvageaggressive", false);
bool fSuccess = bitdb.Salvage(newFilename, fAggressive, salvagedData);
if (salvagedData.empty())
{
LogPrintf("Salvage(aggressive) found no records in %s.\n", newFilename);
LogPrintf("Salvage(%s) found no records in %s.\n", fAggressive ? "aggressive" : "normal", newFilename);
return false;
}
LogPrintf("Salvage(aggressive) found %u records\n", salvagedData.size());
LogPrintf("Salvage(%s) found %u records\n", fAggressive ? "aggressive" : "normal", salvagedData.size());

std::unique_ptr<Db> pdbCopy = MakeUnique<Db>(bitdb.dbenv.get(), 0);
int ret = pdbCopy->open(nullptr, // Txn pointer
Expand Down
1 change: 1 addition & 0 deletions src/wallet/init.cpp
Expand Up @@ -22,6 +22,7 @@ std::string GetWalletHelpString(bool showDebug)
strUsage += HelpMessageOpt("-keypool=<n>", strprintf(_("Set key pool size to <n> (default: %u)"), DEFAULT_KEYPOOL_SIZE));
strUsage += HelpMessageOpt("-rescan", _("Rescan the block chain for missing wallet transactions on startup"));
strUsage += HelpMessageOpt("-salvagewallet", _("Attempt to recover private keys from a corrupt wallet on startup"));
strUsage += HelpMessageOpt("-salvageaggressive", _("Be aggressive during -salvagewallet operation (default: false)"));
strUsage += HelpMessageOpt("-spendzeroconfchange", strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), DEFAULT_SPEND_ZEROCONF_CHANGE));
strUsage += HelpMessageOpt("-txconfirmtarget=<n>", strprintf(_("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)"), DEFAULT_TX_CONFIRM_TARGET));
strUsage += HelpMessageOpt("-upgradewallet", _("Upgrade wallet to latest format on startup"));
Expand Down

0 comments on commit ce19110

Please sign in to comment.