diff options
-rw-r--r-- | src/netaddress.cpp | 11 | ||||
-rw-r--r-- | src/netaddress.h | 1 | ||||
-rw-r--r-- | src/test/fuzz/netaddress.cpp | 1 |
3 files changed, 4 insertions, 9 deletions
diff --git a/src/netaddress.cpp b/src/netaddress.cpp index ba29aa5f64..13c505ca34 100644 --- a/src/netaddress.cpp +++ b/src/netaddress.cpp @@ -911,17 +911,14 @@ std::vector<unsigned char> CService::GetKey() const return key; } -std::string CService::ToStringPort() const -{ - return strprintf("%u", port); -} - std::string CService::ToStringAddrPort() const { + const auto port_str = strprintf("%u", port); + if (IsIPv4() || IsTor() || IsI2P() || IsInternal()) { - return ToStringAddr() + ":" + ToStringPort(); + return ToStringAddr() + ":" + port_str; } else { - return "[" + ToStringAddr() + "]:" + ToStringPort(); + return "[" + ToStringAddr() + "]:" + port_str; } } diff --git a/src/netaddress.h b/src/netaddress.h index 8fb34194cb..a465e53809 100644 --- a/src/netaddress.h +++ b/src/netaddress.h @@ -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); std::vector<unsigned char> GetKey() const; - std::string ToStringPort() const; std::string ToStringAddrPort() const; CService(const struct in6_addr& ipv6Addr, uint16_t port); diff --git a/src/test/fuzz/netaddress.cpp b/src/test/fuzz/netaddress.cpp index ad18b35637..5ffa200238 100644 --- a/src/test/fuzz/netaddress.cpp +++ b/src/test/fuzz/netaddress.cpp @@ -80,7 +80,6 @@ FUZZ_TARGET(netaddress) (void)service.GetKey(); (void)service.GetPort(); (void)service.ToStringAddrPort(); - (void)service.ToStringPort(); (void)CServiceHash()(service); (void)CServiceHash(0, 0)(service); |