Skip to content

Commit 584170a

Browse files
committed
Merge #19142: validation: Make VerifyDB level 4 interruptible
fa3b4f9 validation: Make VerifyDB level 4 interruptible (MarcoFalke) fa1d580 validation: Remove unused boost interruption_point (MarcoFalke) Pull request description: level 0,1,2, and 3 are already interruptible, so make level 4 also interruptible ACKs for top commit: laanwj: Code review ACK fa3b4f9 fanquake: ACK fa3b4f9 Tree-SHA512: d302c84a17add1b5993dd78339c88670d27eee45ce208c4d046ae188b50be9843ee5a9584739d5d25453b54ae08fd1cb6eeee8cb1307d84c05cde8a54a7c445b
2 parents 76e6452 + fa3b4f9 commit 584170a

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/validation.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
#include <string>
5151

5252
#include <boost/algorithm/string/replace.hpp>
53-
#include <boost/thread.hpp>
5453

5554
#if defined(NDEBUG)
5655
# error "Bitcoin cannot be compiled without assertions."
@@ -2859,8 +2858,6 @@ bool CChainState::ActivateBestChain(BlockValidationState &state, const CChainPar
28592858
CBlockIndex *pindexNewTip = nullptr;
28602859
int nStopAtHeight = gArgs.GetArg("-stopatheight", DEFAULT_STOPATHEIGHT);
28612860
do {
2862-
boost::this_thread::interruption_point();
2863-
28642861
// Block until the validation queue drains. This should largely
28652862
// never happen in normal operation, however may happen during
28662863
// reindex, causing memory blowup if we run too far ahead.
@@ -2929,8 +2926,7 @@ bool CChainState::ActivateBestChain(BlockValidationState &state, const CChainPar
29292926
// never shutdown before connecting the genesis block during LoadChainTip(). Previously this
29302927
// caused an assert() failure during shutdown in such cases as the UTXO DB flushing checks
29312928
// that the best block hash is non-null.
2932-
if (ShutdownRequested())
2933-
break;
2929+
if (ShutdownRequested()) break;
29342930
} while (pindexNewTip != pindexMostWork);
29352931
CheckBlockIndex(chainparams.GetConsensus());
29362932

@@ -4272,7 +4268,6 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
42724268
int reportDone = 0;
42734269
LogPrintf("[0%%]..."); /* Continued */
42744270
for (pindex = ::ChainActive().Tip(); pindex && pindex->pprev; pindex = pindex->pprev) {
4275-
boost::this_thread::interruption_point();
42764271
const int percentageDone = std::max(1, std::min(99, (int)(((double)(::ChainActive().Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100))));
42774272
if (reportDone < percentageDone/10) {
42784273
// report every 10% step
@@ -4318,8 +4313,7 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
43184313
nGoodTransactions += block.vtx.size();
43194314
}
43204315
}
4321-
if (ShutdownRequested())
4322-
return true;
4316+
if (ShutdownRequested()) return true;
43234317
}
43244318
if (pindexFailure)
43254319
return error("VerifyDB(): *** coin database inconsistencies found (last %i blocks, %i good transactions before that)\n", ::ChainActive().Height() - pindexFailure->nHeight + 1, nGoodTransactions);
@@ -4330,7 +4324,6 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
43304324
// check level 4: try reconnecting blocks
43314325
if (nCheckLevel >= 4) {
43324326
while (pindex != ::ChainActive().Tip()) {
4333-
boost::this_thread::interruption_point();
43344327
const int percentageDone = std::max(1, std::min(99, 100 - (int)(((double)(::ChainActive().Height() - pindex->nHeight)) / (double)nCheckDepth * 50)));
43354328
if (reportDone < percentageDone/10) {
43364329
// report every 10% step
@@ -4344,6 +4337,7 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
43444337
return error("VerifyDB(): *** ReadBlockFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
43454338
if (!::ChainstateActive().ConnectBlock(block, state, pindex, coins, chainparams))
43464339
return error("VerifyDB(): *** found unconnectable block at %d, hash=%s (%s)", pindex->nHeight, pindex->GetBlockHash().ToString(), state.ToString());
4340+
if (ShutdownRequested()) return true;
43474341
}
43484342
}
43494343

0 commit comments

Comments
 (0)