diff options
Diffstat (limited to 'src/pow.cpp')
-rw-r--r-- | src/pow.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pow.cpp b/src/pow.cpp index 50de8946be..6c8e7e5d98 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -134,8 +134,19 @@ bool PermittedDifficultyTransition(const Consensus::Params& params, int64_t heig return true; } +// Bypasses the actual proof of work check during fuzz testing with a simplified validation checking whether +// the most signficant bit of the last byte of the hash is set. bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params& params) { +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + return (hash.data()[31] & 0x80) == 0; +#else + return CheckProofOfWorkImpl(hash, nBits, params); +#endif +} + +bool CheckProofOfWorkImpl(uint256 hash, unsigned int nBits, const Consensus::Params& params) +{ bool fNegative; bool fOverflow; arith_uint256 bnTarget; |