mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Add FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION in PoW check
To avoid PoW being a blocker for fuzz tests, `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` is used in fuzz builds to bypass the actual PoW validation in `CheckProofOfWork`. It's replaced with a check on the last byte of the hash, which allows the fuzzer to quickly generate (in)valid blocks by checking a single bit, rather than performing the full PoW computation. If PoW is the target of a fuzz test, then it should call `CheckProofOfWorkImpl`.
This commit is contained in:
parent
a3f6f5acd8
commit
a0eaa4749f
4 changed files with 14 additions and 2 deletions
|
|
@ -69,7 +69,7 @@ FUZZ_TARGET(integer, .init = initialize_integer)
|
|||
const bool b = fuzzed_data_provider.ConsumeBool();
|
||||
|
||||
const Consensus::Params& consensus_params = Params().GetConsensus();
|
||||
(void)CheckProofOfWork(u256, u32, consensus_params);
|
||||
(void)CheckProofOfWorkImpl(u256, u32, consensus_params);
|
||||
if (u64 <= MAX_MONEY) {
|
||||
const uint64_t compressed_money_amount = CompressAmount(u64);
|
||||
assert(u64 == DecompressAmount(compressed_money_amount));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue