Browse Source

ContextualCheckBlockHeader should never have pindexPrev to NULL

0.15
NicolasDorier 8 years ago
parent
commit
cc44c8f143
  1. 3
      src/validation.cpp

3
src/validation.cpp

@ -2973,7 +2973,8 @@ std::vector<unsigned char> GenerateCoinbaseCommitment(CBlock& block, const CBloc
bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev, int64_t nAdjustedTime) bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev, int64_t nAdjustedTime)
{ {
const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->nHeight + 1; assert(pindexPrev != NULL);
const int nHeight = pindexPrev->nHeight + 1;
// Check proof of work // Check proof of work
if (block.nBits != GetNextWorkRequired(pindexPrev, &block, consensusParams)) if (block.nBits != GetNextWorkRequired(pindexPrev, &block, consensusParams))
return state.DoS(100, false, REJECT_INVALID, "bad-diffbits", false, "incorrect proof of work"); return state.DoS(100, false, REJECT_INVALID, "bad-diffbits", false, "incorrect proof of work");

Loading…
Cancel
Save