mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-24 22:09:20 +02:00
Introduce g_fuzzing global for fuzzing checks
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <chain.h>
|
||||
#include <primitives/block.h>
|
||||
#include <uint256.h>
|
||||
#include <util/check.h>
|
||||
|
||||
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.
|
||||
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
|
||||
if (g_fuzzing) return (hash.data()[31] & 0x80) == 0;
|
||||
return CheckProofOfWorkImpl(hash, nBits, params);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CheckProofOfWorkImpl(uint256 hash, unsigned int nBits, const Consensus::Params& params)
|
||||
|
||||
Reference in New Issue
Block a user