Skip to content

Commit

Permalink
partial bitcoin#27106: remove orphaned CSubNet::SanityCheck()
Browse files Browse the repository at this point in the history
excludes:
- 30a3230 (spelling correction in `src/blockencodings.h`)
  • Loading branch information
kwvg committed Jan 14, 2025
1 parent 75cc94e commit 3260f2c
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 27 deletions.
2 changes: 1 addition & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3305,7 +3305,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> 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());
Expand Down
23 changes: 0 additions & 23 deletions src/netaddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/netaddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
1 change: 0 additions & 1 deletion test/lint/lint-locale-dependence.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#
# TODO: Reduce KNOWN_VIOLATIONS by replacing uses of locale dependent stoul/strtol with locale
# independent ToIntegral<T>(...).
# TODO: Reduce KNOWN_VIOLATIONS by replacing uses of locale dependent snprintf with strprintf.

import re
import sys
Expand Down

0 comments on commit 3260f2c

Please sign in to comment.