mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
Add and use CNetAddr::HasCJDNSPrefix() helper
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user