@@ -2692,6 +2692,8 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, Spa
2692
2692
2693
2693
const auto current_time{NodeClock::now ()};
2694
2694
int nTries = 0 ;
2695
+ const auto reachable_nets{g_reachable_nets.All ()};
2696
+
2695
2697
while (!interruptNet)
2696
2698
{
2697
2699
if (anchor && !m_anchors.empty ()) {
@@ -2723,7 +2725,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, Spa
2723
2725
if (!addr.IsValid ()) {
2724
2726
// No tried table collisions. Select a new table address
2725
2727
// for our feeler.
2726
- std::tie (addr, addr_last_try) = addrman.Select (true );
2728
+ std::tie (addr, addr_last_try) = addrman.Select (true , reachable_nets );
2727
2729
} else if (AlreadyConnectedToAddress (addr)) {
2728
2730
// If test-before-evict logic would have us connect to a
2729
2731
// peer that we're already connected to, just mark that
@@ -2732,18 +2734,16 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, Spa
2732
2734
// a currently-connected peer.
2733
2735
addrman.Good (addr);
2734
2736
// Select a new table address for our feeler instead.
2735
- std::tie (addr, addr_last_try) = addrman.Select (true );
2737
+ std::tie (addr, addr_last_try) = addrman.Select (true , reachable_nets );
2736
2738
}
2737
2739
} else {
2738
2740
// Not a feeler
2739
2741
// If preferred_net has a value set, pick an extra outbound
2740
2742
// peer from that network. The eviction logic in net_processing
2741
2743
// ensures that a peer from another network will be evicted.
2742
- std::unordered_set<Network> preferred_nets;
2743
- if (preferred_net.has_value ()) {
2744
- preferred_nets = {*preferred_net};
2745
- }
2746
- std::tie (addr, addr_last_try) = addrman.Select (false , preferred_nets);
2744
+ std::tie (addr, addr_last_try) = preferred_net.has_value ()
2745
+ ? addrman.Select (false , {*preferred_net})
2746
+ : addrman.Select (false , reachable_nets);
2747
2747
}
2748
2748
2749
2749
// Require outbound IPv4/IPv6 connections, other than feelers, to be to distinct network groups
0 commit comments