fuzz: Avoid utxo_total_supply timeout

This commit is contained in:
MarcoFalke 2023-11-03 20:02:03 +01:00
parent d9007f51a7
commit fa7ba92630
No known key found for this signature in database

View File

@ -94,8 +94,8 @@ FUZZ_TARGET(utxo_total_supply)
assert(ActiveHeight() == 0);
// Get at which height we duplicate the coinbase
// Assuming that the fuzzer will mine relatively short chains (less than 200 blocks), we want the duplicate coinbase to be not too high.
// Up to 2000 seems reasonable.
int64_t duplicate_coinbase_height = fuzzed_data_provider.ConsumeIntegralInRange(0, 20 * COINBASE_MATURITY);
// Up to 300 seems reasonable.
int64_t duplicate_coinbase_height = fuzzed_data_provider.ConsumeIntegralInRange(0, 300);
// Always pad with OP_0 at the end to avoid bad-cb-length error
const CScript duplicate_coinbase_script = CScript() << duplicate_coinbase_height << OP_0;
// Mine the first block with this duplicate
@ -121,7 +121,7 @@ FUZZ_TARGET(utxo_total_supply)
// Limit to avoid timeout, but enough to cover duplicate_coinbase_height
// and CVE-2018-17144.
LIMITED_WHILE(fuzzed_data_provider.remaining_bytes(), 2'000)
LIMITED_WHILE(fuzzed_data_provider.remaining_bytes(), 2'00)
{
CallOneOf(
fuzzed_data_provider,