diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2023-10-05 15:09:45 +0200 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2023-10-05 15:10:32 +0200 |
commit | 64d6f77907afd461d9b14ee10ab32335f4454734 (patch) | |
tree | 2f5a5ede805ecea6e50746c3beee4ea51d224482 /src/netaddress.h | |
parent | 78fd3c2672400fb958f2d25ddd40955c7deed4cd (diff) | |
download | bitcoin-64d6f77907afd461d9b14ee10ab32335f4454734.tar.xz |
net: put CJDNS prefix byte in a constant
Diffstat (limited to 'src/netaddress.h')
-rw-r--r-- | src/netaddress.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/netaddress.h b/src/netaddress.h index ad09f16799..08dd77c0ff 100644 --- a/src/netaddress.h +++ b/src/netaddress.h @@ -81,6 +81,10 @@ static const std::array<uint8_t, 6> INTERNAL_IN_IPV6_PREFIX{ 0xFD, 0x6B, 0x88, 0xC0, 0x87, 0x24 // 0xFD + sha256("bitcoin")[0:5]. }; +/// All CJDNS addresses start with 0xFC. See +/// https://github.com/cjdelisle/cjdns/blob/master/doc/Whitepaper.md#pulling-it-all-together +static constexpr uint8_t CJDNS_PREFIX{0xFC}; + /// Size of IPv4 address (in bytes). static constexpr size_t ADDR_IPV4_SIZE = 4; @@ -174,7 +178,7 @@ public: [[nodiscard]] bool IsTor() const { return m_net == NET_ONION; } [[nodiscard]] bool IsI2P() const { return m_net == NET_I2P; } [[nodiscard]] bool IsCJDNS() const { return m_net == NET_CJDNS; } - [[nodiscard]] bool HasCJDNSPrefix() const { return m_addr[0] == 0xfc; } + [[nodiscard]] bool HasCJDNSPrefix() const { return m_addr[0] == CJDNS_PREFIX; } bool IsLocal() const; bool IsRoutable() const; bool IsInternal() const; |