Skip to content

Commit db7f4cf

Browse files
committed
fix: move Dash-specific GetMNByService() check to the end of the while loop
Allows non-specific conditions to trigger first for better compatibility
1 parent 8872ba3 commit db7f4cf

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/net.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3507,9 +3507,6 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, CDe
35073507
std::tie(addr, addr_last_try) = addrman.Select(false, preferred_net);
35083508
}
35093509

3510-
auto dmn = mnList.GetMNByService(addr);
3511-
bool isMasternode = dmn != nullptr;
3512-
35133510
// Require outbound IPv4/IPv6 connections, other than feelers, to be to distinct network groups
35143511
if (!fFeeler && outbound_ipv46_peer_netgroups.count(m_netgroupman.GetGroup(addr))) {
35153512
continue;
@@ -3520,10 +3517,6 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, CDe
35203517
break;
35213518
}
35223519

3523-
// don't try to connect to masternodes that we already have a connection to (most likely inbound)
3524-
if (isMasternode && setConnectedMasternodes.count(dmn->proTxHash))
3525-
continue;
3526-
35273520
// don't connect to ourselves
35283521
if (addr.GetPort() == GetListenPort() && IsLocal(addr)) {
35293522
break;
@@ -3566,6 +3559,11 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, CDe
35663559
continue;
35673560
}
35683561

3562+
// don't try to connect to masternodes that we already have a connection to (most likely inbound)
3563+
if (auto dmn = mnList.GetMNByService(addr); dmn && setConnectedMasternodes.count(dmn->proTxHash)) {
3564+
continue;
3565+
}
3566+
35693567
addrConnect = addr;
35703568
break;
35713569
}

0 commit comments

Comments
 (0)