mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
Add and use CNetAddr::HasCJDNSPrefix() helper
This commit is contained in:
parent
5ba73cd0ee
commit
fb4265747c
3 changed files with 3 additions and 3 deletions
|
@ -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…
Reference in a new issue