Made sure major_version of Cryptonote header is correct.

This commit is contained in:
Jianping Wu 2019-04-01 21:57:24 -07:00
parent d8329bd28b
commit 8314daee83

View File

@ -3038,6 +3038,10 @@ static bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos,
static bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, bool fCheckPOW = true)
{
if (block.cnHeader.major_version != consensusParams.GetCryptonoteMajorVersion()) {
return state.Invalid(false, 0, "incorrect-major-version", "Cryptonote major version incorrect");
}
// Check proof of work matches claimed amount
if (fCheckPOW && !CheckProofOfWork(block.GetPoWHash(), block.nBits, consensusParams))
return state.DoS(50, false, REJECT_INVALID, "high-hash", false, "proof of work failed");