From 3260f2cf114ace494c55dde9aad6a1087ad996c2 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Wed, 15 Feb 2023 13:47:14 -0800 Subject: [PATCH] partial bitcoin#27106: remove orphaned CSubNet::SanityCheck() excludes: - 30a3230e8 (spelling correction in `src/blockencodings.h`) --- src/net.cpp | 2 +- src/netaddress.cpp | 23 ----------------------- src/netaddress.h | 2 -- test/lint/lint-locale-dependence.py | 1 - 4 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index 05fc8a0bd3c7b..3d591659faca0 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -3305,7 +3305,7 @@ void CConnman::ThreadOpenConnections(const std::vector connect, CDe // Therefore, we do not add them to addrman in the first place. // In case previously unreachable networks become reachable // (e.g. in case of -onlynet changes by the user), fixed seeds will - // be loaded only for networks for which we have no addressses. + // be loaded only for networks for which we have no addresses. seed_addrs.erase(std::remove_if(seed_addrs.begin(), seed_addrs.end(), [&fixed_seed_networks](const CAddress& addr) { return fixed_seed_networks.count(addr.GetNetwork()) == 0; }), seed_addrs.end()); diff --git a/src/netaddress.cpp b/src/netaddress.cpp index 8f9afcdcd3541..0247e38ebc941 100644 --- a/src/netaddress.cpp +++ b/src/netaddress.cpp @@ -1100,29 +1100,6 @@ bool CSubNet::IsValid() const return valid; } -bool CSubNet::SanityCheck() const -{ - switch (network.m_net) { - case NET_IPV4: - case NET_IPV6: - break; - case NET_ONION: - case NET_I2P: - case NET_CJDNS: - return true; - case NET_INTERNAL: - case NET_UNROUTABLE: - case NET_MAX: - return false; - } - - for (size_t x = 0; x < network.m_addr.size(); ++x) { - if (network.m_addr[x] & ~netmask[x]) return false; - } - - return true; -} - bool operator==(const CSubNet& a, const CSubNet& b) { return a.valid == b.valid && a.network == b.network && !memcmp(a.netmask, b.netmask, 16); diff --git a/src/netaddress.h b/src/netaddress.h index 9302f0e1792c2..b9c0c744e7c73 100644 --- a/src/netaddress.h +++ b/src/netaddress.h @@ -485,8 +485,6 @@ class CSubNet /// Is this value valid? (only used to signal parse errors) bool valid; - bool SanityCheck() const; - public: /** * Construct an invalid subnet (empty, `Match()` always returns false). diff --git a/test/lint/lint-locale-dependence.py b/test/lint/lint-locale-dependence.py index b4403ce5a6fa3..4fc4c4e918278 100755 --- a/test/lint/lint-locale-dependence.py +++ b/test/lint/lint-locale-dependence.py @@ -37,7 +37,6 @@ # # TODO: Reduce KNOWN_VIOLATIONS by replacing uses of locale dependent stoul/strtol with locale # independent ToIntegral(...). -# TODO: Reduce KNOWN_VIOLATIONS by replacing uses of locale dependent snprintf with strprintf. import re import sys