mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Connect to most recently updated address in ThreadOpenMasternodeConnections
It's not a good idea to try to connect to an old address of a masternode. This will also skip connection attempts when the masternode is not in the valid set anymore (banned or collateral spent).
This commit is contained in:
parent
93b1b3d732
commit
60788ce325
10
src/net.cpp
10
src/net.cpp
@ -2056,6 +2056,8 @@ void CConnman::ThreadOpenMasternodeConnections()
|
||||
}
|
||||
});
|
||||
|
||||
auto mnList = deterministicMNManager->GetListAtChainTip();
|
||||
|
||||
CSemaphoreGrant grant(*semMasternodeOutbound);
|
||||
if (interruptNet)
|
||||
return;
|
||||
@ -2069,8 +2071,12 @@ void CConnman::ThreadOpenMasternodeConnections()
|
||||
std::vector<CService> pending;
|
||||
for (const auto& group : masternodeQuorumNodes) {
|
||||
for (const auto& p : group.second) {
|
||||
auto& addr2 = p.first;
|
||||
auto& proRegTxHash = p.second;
|
||||
const auto& proRegTxHash = p.second;
|
||||
auto dmn = mnList.GetValidMN(proRegTxHash);
|
||||
if (!dmn) {
|
||||
continue;
|
||||
}
|
||||
const auto& addr2 = dmn->pdmnState->addr;
|
||||
if (!connectedNodes.count(addr2) && !IsMasternodeOrDisconnectRequested(addr2) && !connectedProRegTxHashes.count(proRegTxHash)) {
|
||||
pending.emplace_back(addr2);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user