Skip to content

Commit

Permalink
fuzz: speed up addrman
Browse files Browse the repository at this point in the history
There is no need to iterate 10'000 times and
call `Add` 10'000 times at once (we only add
1000 addresses at once in practice). These values
were introduced in 214d905.
  • Loading branch information
brunoerg committed Aug 21, 2024
1 parent d79ea80 commit 232bf91
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/test/fuzz/addrman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ FUZZ_TARGET(addrman, .init = initialize_addrman)
}
}
AddrManDeterministic& addr_man = *addr_man_ptr;
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 100) {
CallOneOf(
fuzzed_data_provider,
[&] {
Expand All @@ -247,7 +247,8 @@ FUZZ_TARGET(addrman, .init = initialize_addrman)
},
[&] {
std::vector<CAddress> addresses;
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
// Maximum number of addresses permitted in an ADDR message.
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 1000) {
addresses.push_back(ConsumeAddress(fuzzed_data_provider));
}
addr_man.Add(addresses, ConsumeNetAddr(fuzzed_data_provider), std::chrono::seconds{ConsumeTime(fuzzed_data_provider, 0, 100000000)});
Expand Down

0 comments on commit 232bf91

Please sign in to comment.