Merge pull request #4768

2e28031 Perform CVerifyDB on pcoinsdbview instead of pcoinsTip (Wladimir J. van der Laan)
This commit is contained in:
Wladimir J. van der Laan 2014-09-01 09:41:50 +02:00
commit 93f97aab62
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
4 changed files with 5 additions and 5 deletions

View File

@ -978,7 +978,7 @@ bool AppInit2(boost::thread_group& threadGroup)
} }
uiInterface.InitMessage(_("Verifying blocks...")); uiInterface.InitMessage(_("Verifying blocks..."));
if (!CVerifyDB().VerifyDB(GetArg("-checklevel", 3), if (!CVerifyDB().VerifyDB(pcoinsdbview, GetArg("-checklevel", 3),
GetArg("-checkblocks", 288))) { GetArg("-checkblocks", 288))) {
strLoadError = _("Corrupted block database detected"); strLoadError = _("Corrupted block database detected");
break; break;

View File

@ -2898,7 +2898,7 @@ CVerifyDB::~CVerifyDB()
uiInterface.ShowProgress("", 100); uiInterface.ShowProgress("", 100);
} }
bool CVerifyDB::VerifyDB(int nCheckLevel, int nCheckDepth) bool CVerifyDB::VerifyDB(CCoinsView *coinsview, int nCheckLevel, int nCheckDepth)
{ {
LOCK(cs_main); LOCK(cs_main);
if (chainActive.Tip() == NULL || chainActive.Tip()->pprev == NULL) if (chainActive.Tip() == NULL || chainActive.Tip()->pprev == NULL)
@ -2911,7 +2911,7 @@ bool CVerifyDB::VerifyDB(int nCheckLevel, int nCheckDepth)
nCheckDepth = chainActive.Height(); nCheckDepth = chainActive.Height();
nCheckLevel = std::max(0, std::min(4, nCheckLevel)); nCheckLevel = std::max(0, std::min(4, nCheckLevel));
LogPrintf("Verifying last %i blocks at level %i\n", nCheckDepth, nCheckLevel); LogPrintf("Verifying last %i blocks at level %i\n", nCheckDepth, nCheckLevel);
CCoinsViewCache coins(*pcoinsTip, true); CCoinsViewCache coins(*coinsview, true);
CBlockIndex* pindexState = chainActive.Tip(); CBlockIndex* pindexState = chainActive.Tip();
CBlockIndex* pindexFailure = NULL; CBlockIndex* pindexFailure = NULL;
int nGoodTransactions = 0; int nGoodTransactions = 0;

View File

@ -871,7 +871,7 @@ class CVerifyDB {
public: public:
CVerifyDB(); CVerifyDB();
~CVerifyDB(); ~CVerifyDB();
bool VerifyDB(int nCheckLevel, int nCheckDepth); bool VerifyDB(CCoinsView *coinsview, int nCheckLevel, int nCheckDepth);
}; };
/** An in-memory indexed chain of blocks. */ /** An in-memory indexed chain of blocks. */

View File

@ -432,7 +432,7 @@ Value verifychain(const Array& params, bool fHelp)
if (params.size() > 1) if (params.size() > 1)
nCheckDepth = params[1].get_int(); nCheckDepth = params[1].get_int();
return CVerifyDB().VerifyDB(nCheckLevel, nCheckDepth); return CVerifyDB().VerifyDB(pcoinsTip, nCheckLevel, nCheckDepth);
} }
Value getblockchaininfo(const Array& params, bool fHelp) Value getblockchaininfo(const Array& params, bool fHelp)