Skip to content

Commit

Permalink
Update PoW check to ignore genesis block
Browse files Browse the repository at this point in the history
  • Loading branch information
akyo8 committed Feb 18, 2021
1 parent 1a00326 commit 687bc08
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pow.cpp
Expand Up @@ -78,13 +78,15 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params&
arith_uint256 bnTarget;

bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
std::string hashy = hash.GetHex();

// Check range
if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit))
return false;

// Check proof of work matches claimed amount
if (UintToArith256(hash) > bnTarget)
// Check proof of work matches claimed amount
// NOTE: original cloak genesis block doesn't meet proof of work requirements. check and exclude it.
if (UintToArith256(hash) > bnTarget && hash != params.hashGenesisBlock)
return false;

return true;
Expand Down

0 comments on commit 687bc08

Please sign in to comment.