mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
validation: change pindexPrev->nHeight + 1 to nHeight
This commit is contained in:
parent
5fe9c2cbeb
commit
a2715eb9a5
1 changed files with 4 additions and 1 deletions
|
|
@ -3962,6 +3962,9 @@ 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)
|
||||
{
|
||||
assert(pindexPrev != NULL);
|
||||
const int nHeight = pindexPrev->nHeight + 1;
|
||||
|
||||
// Check proof of work
|
||||
if (!CheckChallenge(block, *pindexPrev, consensusParams))
|
||||
return state.DoS(100, false, REJECT_INVALID, "bad-diffbits", false, "incorrect proof of work");
|
||||
|
|
@ -3971,7 +3974,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
|
|||
return state.Invalid(false, REJECT_INVALID, "time-too-old", "block's timestamp is too early");
|
||||
|
||||
// Check height in header against prev
|
||||
if ((uint32_t)pindexPrev->nHeight + 1 != block.nHeight)
|
||||
if ((uint32_t)nHeight != block.nHeight)
|
||||
return state.Invalid(error("%s: block height in header is incorrect", __func__),
|
||||
REJECT_INVALID, "bad-header-height");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue