Skip to content

Commit

Permalink
Validation time block coinbase (#981)
Browse files Browse the repository at this point in the history
* Yet another check that has been missing (blockTime > cbTime + Clockdirft)

* Fix comment

* Update check to be inside the right place
  • Loading branch information
marpme authored and justinvforvendetta committed Sep 15, 2019
1 parent b4c0681 commit fe76a63
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3165,6 +3165,10 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P
for (unsigned int i = 1; i < block.vtx.size(); i++)
if (block.vtx[i]->IsCoinBase())
return state.DoS(100, false, REJECT_INVALID, "bad-cb-multiple", false, "more than one coinbase");
// Check coinbase timestamp
if (block.GetBlockTime() > (int64_t)block.vtx[0]->nTime + GetMaxClockDrift(chainActive.Height())){
return state.DoS(50, false, REJECT_INVALID, "transaction-time-too-new", false, "block timestamp earlier than transaction timestamp");
}

// Check transactions
for (const auto& tx : block.vtx)
Expand All @@ -3178,6 +3182,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P
return state.DoS(50, false, REJECT_INVALID, "transaction-time-too-new", false, "block timestamp earlier than transaction timestamp");
}


unsigned int nSigOps = 0;
for (const auto& tx : block.vtx)
{
Expand Down

0 comments on commit fe76a63

Please sign in to comment.