Add and use CNetAddr::HasCJDNSPrefix() helper

pull/28078/head
Jon Atack 1 year ago
parent 5ba73cd0ee
commit fb4265747c

@ -275,7 +275,7 @@ std::optional<CService> GetLocalAddrForPeer(CNode& node)
CService MaybeFlipIPv6toCJDNS(const CService& service)
{
CService ret{service};
if (ret.m_net == NET_IPV6 && ret.m_addr[0] == 0xfc && IsReachable(NET_CJDNS)) {
if (ret.m_net == NET_IPV6 && ret.HasCJDNSPrefix() && IsReachable(NET_CJDNS)) {
ret.m_net = NET_CJDNS;
}
return ret;

@ -450,8 +450,7 @@ bool CNetAddr::IsValid() const
return false;
}
// CJDNS addresses always start with 0xfc
if (IsCJDNS() && (m_addr[0] != 0xFC)) {
if (IsCJDNS() && !HasCJDNSPrefix()) {
return false;
}

@ -182,6 +182,7 @@ public:
bool IsTor() const;
bool IsI2P() const;
bool IsCJDNS() const;
[[nodiscard]] bool HasCJDNSPrefix() const { return m_addr[0] == 0xfc; }
bool IsLocal() const;
bool IsRoutable() const;
bool IsInternal() const;

Loading…
Cancel
Save