This PR adds a test to check that a node will not try to connect to an anchor from an unreachable network when initializing. It kills and can be tested with the following mutant:
0diff --git a/src/net.cpp b/src/net.cpp
1index 6b79e913e8..cd8aa4c502 100644
2--- a/src/net.cpp
3+++ b/src/net.cpp
4@@ -2774,7 +2774,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, std
5 if (anchor && !m_anchors.empty()) {
6 const CAddress addr = m_anchors.back();
7 m_anchors.pop_back();
8- if (!addr.IsValid() || IsLocal(addr) || !g_reachable_nets.Contains(addr) ||
9+ if (!addr.IsValid() || IsLocal(addr) ||
10 !m_msgproc->HasAllDesirableServiceFlags(addr.nServices) ||
11 outbound_ipv46_peer_netgroups.contains(m_netgroupman.GetGroup(addr))) continue;
12 addrConnect = addr;
Also, it fixes a bug in assert_debug_log which has a timing asymmetry between expected and unexpected message
checking. When all expected messages were found early, the function would return immediately without waiting for the full timeout period. This created a race condition where unexpected messages appearing after the expected messages (but before the timeout) would not be detected.