validation: Change return value of VerifyDB to enum type

This does not change behavior. It is in preparation for
special handling of the case where VerifyDB doesn't finish
for various reasons, but doesn't fail.
This commit is contained in:
Martin Zumsande
2022-10-06 15:51:09 -04:00
parent 52ddbd52f9
commit 6360b5302d
4 changed files with 40 additions and 22 deletions

View File

@@ -349,12 +349,17 @@ bool HasValidProofOfWork(const std::vector<CBlockHeader>& headers, const Consens
/** Return the sum of the work on a given set of headers */
arith_uint256 CalculateHeadersWork(const std::vector<CBlockHeader>& headers);
enum class VerifyDBResult {
SUCCESS,
CORRUPTED_BLOCK_DB,
};
/** RAII wrapper for VerifyDB: Verify consistency of the block and coin databases */
class CVerifyDB {
public:
CVerifyDB();
~CVerifyDB();
bool VerifyDB(
[[nodiscard]] VerifyDBResult VerifyDB(
Chainstate& chainstate,
const Consensus::Params& consensus_params,
CCoinsView& coinsview,