aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-09-23 12:30:15 +0000
committerMacroFake <falke.marco@gmail.com>2022-09-23 12:30:19 +0000
commit2a56cc1f584cc550a93c165f0dcf93ac85075e19 (patch)
tree771d907bd7dddd88ff82f4fc7a5714e0364ee22e
parent05f7937810269d3582e675255780756138954801 (diff)
parentfa4ba04c157b83b827f7541fa007710bd6211fe7 (diff)
downloadbitcoin-2a56cc1f584cc550a93c165f0dcf93ac85075e19.tar.xz
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
-rw-r--r--src/test/fuzz/bitdeque.cpp7
-rw-r--r--src/test/fuzz/pow.cpp2
2 files changed, 4 insertions, 5 deletions
diff --git a/src/test/fuzz/bitdeque.cpp b/src/test/fuzz/bitdeque.cpp
index 01af8320b5..634a3de346 100644
--- a/src/test/fuzz/bitdeque.cpp
+++ b/src/test/fuzz/bitdeque.cpp
@@ -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)
}
);
}
-
}
diff --git a/src/test/fuzz/pow.cpp b/src/test/fuzz/pow.cpp
index 507ce57ec0..eba03da773 100644
--- a/src/test/fuzz/pow.cpp
+++ b/src/test/fuzz/pow.cpp
@@ -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)};