mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-12 11:19:08 -05:00
Merge bitcoin/bitcoin#27106: net: remove orphaned CSubNet::SanityCheck()
30a3230e86
script: remove out-of-date snprintf TODO (Jon Atack)0e015146bd
net: remove orphaned CSubNet::SanityCheck() (Jon Atack) Pull request description: `CSubNet::SanityCheck()` was added in #20140, and not removed in #22570 when it became orphaned code. Also, remove an out-of-date `snprintf` TODO that was resolved in #27036, and fix up 2 words to make the spelling linter green again. ACKs for top commit: fanquake: ACK30a3230e86
pinheadmz: ACK30a3230e86
brunoerg: crACK30a3230e86
Tree-SHA512: f91a2a5af902d3b82ab496f19deeac17d58dbf72a8016e880ea61ad858b66e7ea0ae70b964c4032018eb3252cc34ac5fea163131c6a7f1baf87fc9ec9b5833d8
This commit is contained in:
commit
bc35c4f58c
5 changed files with 2 additions and 29 deletions
|
@ -135,7 +135,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
CBlockHeader header;
|
CBlockHeader header;
|
||||||
|
|
||||||
// Can be overriden for testing
|
// Can be overridden for testing
|
||||||
using CheckBlockFn = std::function<bool(const CBlock&, BlockValidationState&, const Consensus::Params&, bool, bool)>;
|
using CheckBlockFn = std::function<bool(const CBlock&, BlockValidationState&, const Consensus::Params&, bool, bool)>;
|
||||||
CheckBlockFn m_check_block_mock{nullptr};
|
CheckBlockFn m_check_block_mock{nullptr};
|
||||||
|
|
||||||
|
|
|
@ -1671,7 +1671,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
|
||||||
// Therefore, we do not add them to addrman in the first place.
|
// Therefore, we do not add them to addrman in the first place.
|
||||||
// In case previously unreachable networks become reachable
|
// In case previously unreachable networks become reachable
|
||||||
// (e.g. in case of -onlynet changes by the user), fixed seeds will
|
// (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(),
|
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; }),
|
[&fixed_seed_networks](const CAddress& addr) { return fixed_seed_networks.count(addr.GetNetwork()) == 0; }),
|
||||||
seed_addrs.end());
|
seed_addrs.end());
|
||||||
|
|
|
@ -1106,29 +1106,6 @@ bool CSubNet::IsValid() const
|
||||||
return valid;
|
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)
|
bool operator==(const CSubNet& a, const CSubNet& b)
|
||||||
{
|
{
|
||||||
return a.valid == b.valid && a.network == b.network && !memcmp(a.netmask, b.netmask, 16);
|
return a.valid == b.valid && a.network == b.network && !memcmp(a.netmask, b.netmask, 16);
|
||||||
|
|
|
@ -476,8 +476,6 @@ protected:
|
||||||
/// Is this value valid? (only used to signal parse errors)
|
/// Is this value valid? (only used to signal parse errors)
|
||||||
bool valid;
|
bool valid;
|
||||||
|
|
||||||
bool SanityCheck() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Construct an invalid subnet (empty, `Match()` always returns false).
|
* Construct an invalid subnet (empty, `Match()` always returns false).
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
#
|
#
|
||||||
# See https://doc.qt.io/qt-5/qcoreapplication.html#locale-settings and
|
# See https://doc.qt.io/qt-5/qcoreapplication.html#locale-settings and
|
||||||
# https://stackoverflow.com/a/34878283 for more details.
|
# https://stackoverflow.com/a/34878283 for more details.
|
||||||
#
|
|
||||||
# TODO: Reduce KNOWN_VIOLATIONS by replacing uses of locale dependent snprintf with strprintf.
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
Loading…
Add table
Reference in a new issue