Merge bitcoin/bitcoin#26160: [24.x] fuzz: Avoid timeout in bitdeque fuzz target

fa4ba04c157b83b827f7541fa007710bd6211fe7 fuzz: Remove no-op call to get() (MacroFake)
fa642286b83f29cb0ac0c8d4c7d8eba10600402c fuzz: Avoid timeout in bitdeque fuzz target (MacroFake)

Pull request description:

  Identical commit from https://github.com/bitcoin/bitcoin/pull/26012

  Not strictly required for 24.x, but I guess it can't hurt to avoid timeouts.

Top commit has no ACKs.

Tree-SHA512: 4d4bfb645e3513bf22cc9c64bdcbde2ad9e28b5a07ab07a02fbfa19df02147b371d2ca794ab3a095c22b66781832055e0de3af908aaead4c26ea12189e05cbe3
This commit is contained in:
MacroFake 2022-09-23 12:30:15 +00:00
commit 2a56cc1f58
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548
2 changed files with 4 additions and 5 deletions

View File

@ -2,11 +2,10 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <util/bitdeque.h>
#include <random.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/util.h>
#include <util/bitdeque.h>
#include <deque>
#include <vector>
@ -54,7 +53,8 @@ FUZZ_TARGET_INIT(bitdeque, InitRandData)
--initlen;
}
while (provider.remaining_bytes()) {
LIMITED_WHILE(provider.remaining_bytes() > 0, 900)
{
{
assert(deq.size() == bitdeq.size());
auto it = deq.begin();
@ -538,5 +538,4 @@ FUZZ_TARGET_INIT(bitdeque, InitRandData)
}
);
}
}

View File

@ -114,7 +114,7 @@ FUZZ_TARGET_INIT(pow_transition, initialize_pow)
auto current_block{std::make_unique<CBlockIndex>(header)};
current_block->pprev = blocks.empty() ? nullptr : blocks.back().get();
current_block->nHeight = height;
blocks.emplace_back(std::move(current_block)).get();
blocks.emplace_back(std::move(current_block));
}
auto last_block{blocks.back().get()};
unsigned int new_nbits{GetNextWorkRequired(last_block, nullptr, consensus_params)};