mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 11:13:23 -03:00
fuzz: Avoid timeout in utxo_total_supply
This commit is contained in:
parent
f467b28ac3
commit
fafb4da121
1 changed files with 8 additions and 6 deletions
|
@ -119,7 +119,9 @@ FUZZ_TARGET(utxo_total_supply)
|
||||||
current_block = PrepareNextBlock();
|
current_block = PrepareNextBlock();
|
||||||
StoreLastTxo();
|
StoreLastTxo();
|
||||||
|
|
||||||
LIMITED_WHILE(fuzzed_data_provider.remaining_bytes(), 100'000)
|
// Limit to avoid timeout, but enough to cover duplicate_coinbase_height
|
||||||
|
// and CVE-2018-17144.
|
||||||
|
LIMITED_WHILE(fuzzed_data_provider.remaining_bytes(), 2'000)
|
||||||
{
|
{
|
||||||
CallOneOf(
|
CallOneOf(
|
||||||
fuzzed_data_provider,
|
fuzzed_data_provider,
|
||||||
|
@ -142,14 +144,14 @@ FUZZ_TARGET(utxo_total_supply)
|
||||||
node::RegenerateCommitments(*current_block, chainman);
|
node::RegenerateCommitments(*current_block, chainman);
|
||||||
const bool was_valid = !MineBlock(node, current_block).IsNull();
|
const bool was_valid = !MineBlock(node, current_block).IsNull();
|
||||||
|
|
||||||
|
if (duplicate_coinbase_height == ActiveHeight()) {
|
||||||
|
// we mined the duplicate coinbase
|
||||||
|
assert(current_block->vtx.at(0)->vin.at(0).scriptSig == duplicate_coinbase_script);
|
||||||
|
}
|
||||||
|
|
||||||
const auto prev_utxo_stats = utxo_stats;
|
const auto prev_utxo_stats = utxo_stats;
|
||||||
if (was_valid) {
|
if (was_valid) {
|
||||||
circulation += GetBlockSubsidy(ActiveHeight(), Params().GetConsensus());
|
circulation += GetBlockSubsidy(ActiveHeight(), Params().GetConsensus());
|
||||||
|
|
||||||
if (duplicate_coinbase_height == ActiveHeight()) {
|
|
||||||
// we mined the duplicate coinbase
|
|
||||||
assert(current_block->vtx.at(0)->vin.at(0).scriptSig == duplicate_coinbase_script);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateUtxoStats();
|
UpdateUtxoStats();
|
||||||
|
|
Loading…
Add table
Reference in a new issue