Auto merge of #2977 - str4d:loadblockindexguts-correctness, r=str4d

Check Equihash solution when loading block index

An additional consistency check, which also ensures that the in-memory representation
matches the stored index.
This commit is contained in:
Homu 2018-02-21 19:05:23 -08:00
commit 50400310af
1 changed files with 3 additions and 0 deletions

View File

@ -314,6 +314,9 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
pindexNew->nTx = diskindex.nTx;
pindexNew->nSproutValue = diskindex.nSproutValue;
auto header = pindexNew->GetBlockHeader();
if (!CheckEquihashSolution(&header, Params()))
return error("LoadBlockIndex(): CheckEquihashSolution failed: %s", pindexNew->ToString());
if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus()))
return error("LoadBlockIndex(): CheckProofOfWork failed: %s", pindexNew->ToString());