mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 06:43:45 +01:00
VerifyDB progress
This commit is contained in:
14
src/main.cpp
14
src/main.cpp
@@ -2968,7 +2968,17 @@ bool static LoadBlockIndexDB()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VerifyDB(int nCheckLevel, int nCheckDepth)
|
||||
CVerifyDB::CVerifyDB()
|
||||
{
|
||||
uiInterface.ShowProgress(_("Verifying blocks..."), 0);
|
||||
}
|
||||
|
||||
CVerifyDB::~CVerifyDB()
|
||||
{
|
||||
uiInterface.ShowProgress("", 100);
|
||||
}
|
||||
|
||||
bool CVerifyDB::VerifyDB(int nCheckLevel, int nCheckDepth)
|
||||
{
|
||||
LOCK(cs_main);
|
||||
if (chainActive.Tip() == NULL || chainActive.Tip()->pprev == NULL)
|
||||
@@ -2989,6 +2999,7 @@ bool VerifyDB(int nCheckLevel, int nCheckDepth)
|
||||
for (CBlockIndex* pindex = chainActive.Tip(); pindex && pindex->pprev; pindex = pindex->pprev)
|
||||
{
|
||||
boost::this_thread::interruption_point();
|
||||
uiInterface.ShowProgress(_("Verifying blocks..."), std::max(1, std::min(99, (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100)))));
|
||||
if (pindex->nHeight < chainActive.Height()-nCheckDepth)
|
||||
break;
|
||||
CBlock block;
|
||||
@@ -3028,6 +3039,7 @@ bool VerifyDB(int nCheckLevel, int nCheckDepth)
|
||||
CBlockIndex *pindex = pindexState;
|
||||
while (pindex != chainActive.Tip()) {
|
||||
boost::this_thread::interruption_point();
|
||||
uiInterface.ShowProgress(_("Verifying blocks..."), std::max(1, std::min(99, 100 - (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * 50))));
|
||||
pindex = chainActive.Next(pindex);
|
||||
CBlock block;
|
||||
if (!ReadBlockFromDisk(block, pindex))
|
||||
|
||||
Reference in New Issue
Block a user