Using specific functions like ConsumeService, ConsumeAddress and ConsumeNetAddr may be more effective than using ConsumeDeserializable. They always return some value while ConsumeDeserializable may return std::nullopt.
E.g.: In this part of the code, if op_net_addr is std::nullopt, we basically generated the addresses (if so) unnecessarily, because we won't be able to use them:
std::vector<CAddress> addresses;
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
const std::optional<CAddress> opt_address = ConsumeDeserializable<CAddress>(fuzzed_data_provider);
if (!opt_address) {
break;
}
addresses.push_back(*opt_address);
}
const std::optional<CNetAddr> opt_net_addr = ConsumeDeserializable<CNetAddr>(fuzzed_data_provider);
if (opt_net_addr) {
addr_man.Add(addresses, *opt_net_addr, std::chrono::seconds{ConsumeTime(fuzzed_data_provider, 0, 100000000)});
}
Also, if we are not calling Add effectively, it would also be affect other functions that may "depend" on it.