diff options
author | NicolasDorier <nicolas.dorier@gmail.com> | 2016-09-05 15:55:04 +0900 |
---|---|---|
committer | NicolasDorier <nicolas.dorier@gmail.com> | 2017-02-15 22:11:28 +0900 |
commit | cc44c8f143e9ce6e10aeed2f6faf2ca589e910a4 (patch) | |
tree | 06fb59116a47abec079c884145abec86c66301fa /src | |
parent | d8e8b06bd0659b35e51effe35400408ec15bb09b (diff) |
ContextualCheckBlockHeader should never have pindexPrev to NULL
Diffstat (limited to 'src')
-rw-r--r-- | src/validation.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index fe8f8365be..a83737377a 100644 --- a/src/validation.cpp +++ b/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) { - const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->nHeight + 1; + assert(pindexPrev != NULL); + const int nHeight = pindexPrev->nHeight + 1; // Check proof of work if (block.nBits != GetNextWorkRequired(pindexPrev, &block, consensusParams)) return state.DoS(100, false, REJECT_INVALID, "bad-diffbits", false, "incorrect proof of work"); |