|
|
@ -9,6 +9,7 @@
|
|
|
|
#include <chain.h>
|
|
|
|
#include <chain.h>
|
|
|
|
#include <primitives/block.h>
|
|
|
|
#include <primitives/block.h>
|
|
|
|
#include <uint256.h>
|
|
|
|
#include <uint256.h>
|
|
|
|
|
|
|
|
#include <util/check.h>
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
|
|
|
|
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -138,11 +139,8 @@ bool PermittedDifficultyTransition(const Consensus::Params& params, int64_t heig
|
|
|
|
// the most signficant bit of the last byte of the hash is set.
|
|
|
|
// the most signficant bit of the last byte of the hash is set.
|
|
|
|
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params& params)
|
|
|
|
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params& params)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
|
|
|
if (g_fuzzing) return (hash.data()[31] & 0x80) == 0;
|
|
|
|
return (hash.data()[31] & 0x80) == 0;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
return CheckProofOfWorkImpl(hash, nBits, params);
|
|
|
|
return CheckProofOfWorkImpl(hash, nBits, params);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CheckProofOfWorkImpl(uint256 hash, unsigned int nBits, const Consensus::Params& params)
|
|
|
|
bool CheckProofOfWorkImpl(uint256 hash, unsigned int nBits, const Consensus::Params& params)
|
|
|
|