Skip to content

Commit

Permalink
addrv2: fix clearnet count to include Tor
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoerg committed Jul 3, 2024
1 parent 18b619a commit e2093b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions targets/addrv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ std::optional<std::pair<uint64_t, uint64_t>> Addrv2Core(Span<const uint8_t> buff
{
std::vector<CAddress> addrs;
DataStream ds{buffer};
uint64_t clearnet_count{0};
uint64_t clearnet_tor_count{0};
try {
ds >> CAddress::V2_NETWORK(addrs);
if (addrs.size() > 1000) return std::nullopt;
for (auto& addr : addrs) {
if (addr.IsIPv4() || addr.IsIPv6()) clearnet_count++;
if (addr.IsIPv4() || addr.IsIPv6() || addr.IsTor()) clearnet_tor_count++;
if (!addr.IsValid()) return std::nullopt;
}
} catch (const std::ios_base::failure&) {
return std::nullopt;
}

return std::make_pair(addrs.size(), clearnet_count);
return std::make_pair(addrs.size(), clearnet_tor_count);
}

void Addrv2(FuzzedDataProvider& provider)
Expand Down

0 comments on commit e2093b4

Please sign in to comment.