mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-19 18:39:10 +01:00
Merge bitcoin/bitcoin#26160: [24.x] fuzz: Avoid timeout in bitdeque fuzz target
fa4ba04c15fuzz: Remove no-op call to get() (MacroFake)fa642286b8fuzz: 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:
@@ -2,11 +2,10 @@
|
|||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <util/bitdeque.h>
|
|
||||||
|
|
||||||
#include <random.h>
|
#include <random.h>
|
||||||
#include <test/fuzz/FuzzedDataProvider.h>
|
#include <test/fuzz/FuzzedDataProvider.h>
|
||||||
#include <test/fuzz/util.h>
|
#include <test/fuzz/util.h>
|
||||||
|
#include <util/bitdeque.h>
|
||||||
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -54,7 +53,8 @@ FUZZ_TARGET_INIT(bitdeque, InitRandData)
|
|||||||
--initlen;
|
--initlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (provider.remaining_bytes()) {
|
LIMITED_WHILE(provider.remaining_bytes() > 0, 900)
|
||||||
|
{
|
||||||
{
|
{
|
||||||
assert(deq.size() == bitdeq.size());
|
assert(deq.size() == bitdeq.size());
|
||||||
auto it = deq.begin();
|
auto it = deq.begin();
|
||||||
@@ -538,5 +538,4 @@ FUZZ_TARGET_INIT(bitdeque, InitRandData)
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ FUZZ_TARGET_INIT(pow_transition, initialize_pow)
|
|||||||
auto current_block{std::make_unique<CBlockIndex>(header)};
|
auto current_block{std::make_unique<CBlockIndex>(header)};
|
||||||
current_block->pprev = blocks.empty() ? nullptr : blocks.back().get();
|
current_block->pprev = blocks.empty() ? nullptr : blocks.back().get();
|
||||||
current_block->nHeight = height;
|
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()};
|
auto last_block{blocks.back().get()};
|
||||||
unsigned int new_nbits{GetNextWorkRequired(last_block, nullptr, consensus_params)};
|
unsigned int new_nbits{GetNextWorkRequired(last_block, nullptr, consensus_params)};
|
||||||
|
|||||||
Reference in New Issue
Block a user