Skip to content

Commit

Permalink
fuzz: Avoid utxo_total_supply timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Nov 3, 2023
1 parent d9007f5 commit fa7ba92
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/test/fuzz/utxo_total_supply.cpp
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit fa7ba92

Please sign in to comment.