Commit 5cbc1575 authored by Ashot's avatar Ashot

Fixed pow check

parent dd1eb53a
Pipeline #948 passed with stage
in 74 minutes and 23 seconds
......@@ -244,6 +244,12 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits)
bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
if (Params().NetworkID() == CBaseChainParams::TESTNET && chainActive.Height() >= 140394)
{
// Increase testnet difficulty
Params(CBaseChainParams::TESTNET).SetProofOfWorkLimit(~arith_uint256(0) >> 14);
}
// Check range
if (fNegative || bnTarget == 0 || fOverflow || bnTarget > Params().ProofOfWorkLimit())
return error("CheckProofOfWork() : nBits below minimum work");
......
......@@ -11,6 +11,7 @@
class CBlockHeader;
class CBlockIndex;
class uint256;
class CChain;
class arith_uint256;
// Define difficulty retarget algorithms
......@@ -26,5 +27,6 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
/** Check whether a block hash satisfies the proof-of-work requirement specified by nBits */
bool CheckProofOfWork(uint256 hash, unsigned int nBits);
arith_uint256 GetBlockProof(const CBlockIndex& block);
extern CChain chainActive;
#endif // BITCOIN_POW_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment