From 0e015146bd98831290b2b141914e3f93baf5bf8f Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Wed, 15 Feb 2023 13:47:14 -0800 Subject: [PATCH 1/2] net: remove orphaned CSubNet::SanityCheck() CSubNet::SanityCheck() was added in #20140, and not removed in #22570 when it became orphaned code. --- src/netaddress.cpp | 23 ----------------------- src/netaddress.h | 2 -- 2 files changed, 25 deletions(-) diff --git a/src/netaddress.cpp b/src/netaddress.cpp index 782b692d30..7672eb66a0 100644 --- a/src/netaddress.cpp +++ b/src/netaddress.cpp @@ -1106,29 +1106,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 7f782674d3..c4e521fe4b 100644 --- a/src/netaddress.h +++ b/src/netaddress.h @@ -476,8 +476,6 @@ protected: /// 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). From 30a3230e86dfd49c771432be6219841df5066eb4 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Wed, 15 Feb 2023 14:03:37 -0800 Subject: [PATCH 2/2] script: remove out-of-date snprintf TODO that was resolved in PR27036 "test: Remove last uses of snprintf and simplify" and while here, fix up 2 words in docs to make the spelling linter green again. --- src/blockencodings.h | 2 +- src/net.cpp | 2 +- test/lint/lint-locale-dependence.py | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/blockencodings.h b/src/blockencodings.h index 7207ff1ae2..afdfa426f1 100644 --- a/src/blockencodings.h +++ b/src/blockencodings.h @@ -135,7 +135,7 @@ protected: public: CBlockHeader header; - // Can be overriden for testing + // Can be overridden for testing using CheckBlockFn = std::function; CheckBlockFn m_check_block_mock{nullptr}; diff --git a/src/net.cpp b/src/net.cpp index 4f4e443976..884fe25543 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1671,7 +1671,7 @@ void CConnman::ThreadOpenConnections(const std::vector connect) // 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/test/lint/lint-locale-dependence.py b/test/lint/lint-locale-dependence.py index b37ba05a93..faea643882 100755 --- a/test/lint/lint-locale-dependence.py +++ b/test/lint/lint-locale-dependence.py @@ -34,8 +34,6 @@ # # See https://doc.qt.io/qt-5/qcoreapplication.html#locale-settings and # https://stackoverflow.com/a/34878283 for more details. -# -# TODO: Reduce KNOWN_VIOLATIONS by replacing uses of locale dependent snprintf with strprintf. import re import sys