mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-09 15:18:03 +02:00
Merge bitcoin/bitcoin#34479: fuzz: Add and use NodeClockContext
faea12ecd9test: Fixup docs for NodeClockContext and SteadyClockContext (MarcoFalke)eeeeb2a0b9fuzz: Use NodeClockContext (MarcoFalke)fa4fae6227test: Add NodeClockContext (MarcoFalke) Pull request description: Iterating over fuzz inputs will usually be done in the same process. As the mocktime is global, it can theoretically leak from one fuzz input run into the next run, making it less deterministic. Fix this issue, by adding and using a context manager to handle the mocktime and reset it before the end. This refactor should not change any behavior. ACKs for top commit: seduless: re-ACKfaea12ecd9dergoegge: utACKfaea12ecd9brunoerg: code review ACKfaea12ecd9Tree-SHA512: e222c4e4217a504d058b30f1e975dfdfff019363c82385bd62f368b16fb029c46a5d1b43cd773dbdd9efcd7f968d46dbe2c75812971696b1b879b8f081fc6b1b
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <test/fuzz/util/net.h>
|
||||
#include <test/fuzz/util/threadinterrupt.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <test/util/time.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <cstdint>
|
||||
@@ -40,7 +41,7 @@ FUZZ_TARGET(connman, .init = initialize_connman)
|
||||
{
|
||||
SeedRandomStateForTest(SeedRand::ZEROS);
|
||||
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
|
||||
SetMockTime(ConsumeTime(fuzzed_data_provider));
|
||||
NodeClockContext clock_ctx{ConsumeTime(fuzzed_data_provider)};
|
||||
auto netgroupman{ConsumeNetGroupManager(fuzzed_data_provider)};
|
||||
auto addr_man_ptr{std::make_unique<AddrManDeterministic>(netgroupman, fuzzed_data_provider, GetCheckRatio())};
|
||||
if (fuzzed_data_provider.ConsumeBool()) {
|
||||
|
||||
Reference in New Issue
Block a user