net: remove CService::ToStringPort()

It is used only internally in `CService::ToStringAddrPort()`.
This commit is contained in:
Vasil Dimov 2022-07-15 17:56:30 +02:00
parent fd4f0f41e9
commit c9d548c91f
No known key found for this signature in database
GPG key ID: 54DF06F64B55CBBF
3 changed files with 4 additions and 9 deletions

View file

@ -911,17 +911,14 @@ std::vector<unsigned char> CService::GetKey() const
return key; return key;
} }
std::string CService::ToStringPort() const
{
return strprintf("%u", port);
}
std::string CService::ToStringAddrPort() const std::string CService::ToStringAddrPort() const
{ {
const auto port_str = strprintf("%u", port);
if (IsIPv4() || IsTor() || IsI2P() || IsInternal()) { if (IsIPv4() || IsTor() || IsI2P() || IsInternal()) {
return ToStringAddr() + ":" + ToStringPort(); return ToStringAddr() + ":" + port_str;
} else { } else {
return "[" + ToStringAddr() + "]:" + ToStringPort(); return "[" + ToStringAddr() + "]:" + port_str;
} }
} }

View file

@ -535,7 +535,6 @@ public:
friend bool operator!=(const CService& a, const CService& b) { return !(a == b); } friend bool operator!=(const CService& a, const CService& b) { return !(a == b); }
friend bool operator<(const CService& a, const CService& b); friend bool operator<(const CService& a, const CService& b);
std::vector<unsigned char> GetKey() const; std::vector<unsigned char> GetKey() const;
std::string ToStringPort() const;
std::string ToStringAddrPort() const; std::string ToStringAddrPort() const;
CService(const struct in6_addr& ipv6Addr, uint16_t port); CService(const struct in6_addr& ipv6Addr, uint16_t port);

View file

@ -80,7 +80,6 @@ FUZZ_TARGET(netaddress)
(void)service.GetKey(); (void)service.GetKey();
(void)service.GetPort(); (void)service.GetPort();
(void)service.ToStringAddrPort(); (void)service.ToStringAddrPort();
(void)service.ToStringPort();
(void)CServiceHash()(service); (void)CServiceHash()(service);
(void)CServiceHash(0, 0)(service); (void)CServiceHash(0, 0)(service);