mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 06:43:45 +01:00
validation: report if pruning prevents completion of verification
Now the verifychain RPC returns false if the checks didn't finish because the blocks requested to be queried have been pruned.
This commit is contained in:
@@ -4081,6 +4081,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
|
||||
int nGoodTransactions = 0;
|
||||
BlockValidationState state;
|
||||
int reportDone = 0;
|
||||
bool skipped_no_block_data{false};
|
||||
bool skipped_l3_checks{false};
|
||||
LogPrintf("Verification progress: 0%%\n");
|
||||
|
||||
@@ -4100,7 +4101,8 @@ VerifyDBResult CVerifyDB::VerifyDB(
|
||||
if ((chainstate.m_blockman.IsPruneMode() || is_snapshot_cs) && !(pindex->nStatus & BLOCK_HAVE_DATA)) {
|
||||
// If pruning or running under an assumeutxo snapshot, only go
|
||||
// back as far as we have data.
|
||||
LogPrintf("VerifyDB(): block verification stopping at height %d (pruning, no data)\n", pindex->nHeight);
|
||||
LogPrintf("VerifyDB(): block verification stopping at height %d (no data). This could be due to pruning or use of an assumeutxo snapshot.\n", pindex->nHeight);
|
||||
skipped_no_block_data = true;
|
||||
break;
|
||||
}
|
||||
CBlock block;
|
||||
@@ -4188,6 +4190,9 @@ VerifyDBResult CVerifyDB::VerifyDB(
|
||||
if (skipped_l3_checks) {
|
||||
return VerifyDBResult::SKIPPED_L3_CHECKS;
|
||||
}
|
||||
if (skipped_no_block_data) {
|
||||
return VerifyDBResult::SKIPPED_MISSING_BLOCKS;
|
||||
}
|
||||
return VerifyDBResult::SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user