Skip to content

Commit cc44c8f

Browse files
committed
ContextualCheckBlockHeader should never have pindexPrev to NULL
1 parent d8e8b06 commit cc44c8f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/validation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2973,7 +2973,8 @@ std::vector<unsigned char> GenerateCoinbaseCommitment(CBlock& block, const CBloc
29732973

29742974
bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev, int64_t nAdjustedTime)
29752975
{
2976-
const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->nHeight + 1;
2976+
assert(pindexPrev != NULL);
2977+
const int nHeight = pindexPrev->nHeight + 1;
29772978
// Check proof of work
29782979
if (block.nBits != GetNextWorkRequired(pindexPrev, &block, consensusParams))
29792980
return state.DoS(100, false, REJECT_INVALID, "bad-diffbits", false, "incorrect proof of work");

0 commit comments

Comments
 (0)