MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / CheckBlockHeader

Function CheckBlockHeader

src/main.cpp:3284–3297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3282}
3283
3284bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool fCheckPOW)
3285{
3286 // Check proof of work matches claimed amount
3287 if (fCheckPOW && !CheckProofOfWork(block.GetHash(), block.nBits, Params().GetConsensus()))
3288 return state.DoS(50, error("CheckBlockHeader(): proof of work failed"),
3289 REJECT_INVALID, "high-hash");
3290
3291 // Check timestamp
3292 if (block.GetBlockTime() > GetAdjustedTime() + 2 * 60 * 60)
3293 return state.Invalid(error("CheckBlockHeader(): block timestamp too far in the future"),
3294 REJECT_INVALID, "time-too-new");
3295
3296 return true;
3297}
3298
3299bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bool fCheckMerkleRoot)
3300{

Callers 2

CheckBlockFunction · 0.85
AcceptBlockHeaderFunction · 0.85

Calls 8

CheckProofOfWorkFunction · 0.85
errorFunction · 0.85
GetAdjustedTimeFunction · 0.85
DoSMethod · 0.80
InvalidMethod · 0.80
ParamsClass · 0.70
GetHashMethod · 0.45
GetBlockTimeMethod · 0.45

Tested by

no test coverage detected