mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
fuzz: move ConsumeNetGroupManager
to util
This commit is contained in:
parent
fe624631ae
commit
18c8a0945b
2 changed files with 8 additions and 7 deletions
|
@ -39,13 +39,6 @@ void initialize_addrman()
|
|||
g_setup = testing_setup.get();
|
||||
}
|
||||
|
||||
[[nodiscard]] inline NetGroupManager ConsumeNetGroupManager(FuzzedDataProvider& fuzzed_data_provider) noexcept
|
||||
{
|
||||
std::vector<bool> asmap = ConsumeRandomLengthBitVector(fuzzed_data_provider);
|
||||
if (!SanityCheckASMap(asmap, 128)) asmap.clear();
|
||||
return NetGroupManager(asmap);
|
||||
}
|
||||
|
||||
FUZZ_TARGET(data_stream_addr_man, .init = initialize_addrman)
|
||||
{
|
||||
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <test/fuzz/util.h>
|
||||
#include <test/util/net.h>
|
||||
#include <threadsafety.h>
|
||||
#include <util/asmap.h>
|
||||
#include <util/sock.h>
|
||||
|
||||
#include <chrono>
|
||||
|
@ -197,6 +198,13 @@ public:
|
|||
return FuzzedSock{fuzzed_data_provider};
|
||||
}
|
||||
|
||||
[[nodiscard]] inline NetGroupManager ConsumeNetGroupManager(FuzzedDataProvider& fuzzed_data_provider) noexcept
|
||||
{
|
||||
std::vector<bool> asmap = ConsumeRandomLengthBitVector(fuzzed_data_provider);
|
||||
if (!SanityCheckASMap(asmap, 128)) asmap.clear();
|
||||
return NetGroupManager(asmap);
|
||||
}
|
||||
|
||||
inline CSubNet ConsumeSubNet(FuzzedDataProvider& fuzzed_data_provider) noexcept
|
||||
{
|
||||
return {ConsumeNetAddr(fuzzed_data_provider), fuzzed_data_provider.ConsumeIntegral<uint8_t>()};
|
||||
|
|
Loading…
Add table
Reference in a new issue