Skip to content

Commit

Permalink
fix: probe nodes must be disconnected ignoring all the other conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 committed Oct 31, 2023
1 parent 6829e9c commit c0bf54c
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions src/masternode/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,33 @@ void CMasternodeUtils::DoMaintenance(CConnman& connman, const CMasternodeSync& m
}

connman.ForEachNode(CConnman::AllNodes, [&](CNode* pnode) {
// we're only disconnecting m_masternode_connection connections
if (!pnode->m_masternode_connection) return;
if (!pnode->GetVerifiedProRegTxHash().IsNull()) {
// keep _verified_ LLMQ connections
if (connman.IsMasternodeQuorumNode(pnode)) {
return;
}
// keep _verified_ LLMQ relay connections
if (connman.IsMasternodeQuorumRelayMember(pnode->GetVerifiedProRegTxHash())) {
if (pnode->m_masternode_probe_connection) {
// we're not disconnecting masternode probes for at least a few seconds
if (GetSystemTimeInSeconds() - pnode->nTimeConnected < 5) return;
} else {
// we're only disconnecting m_masternode_connection connections
if (!pnode->m_masternode_connection) return;
if (!pnode->GetVerifiedProRegTxHash().IsNull()) {
// keep _verified_ LLMQ connections
if (connman.IsMasternodeQuorumNode(pnode)) {
return;
}
// keep _verified_ LLMQ relay connections
if (connman.IsMasternodeQuorumRelayMember(pnode->GetVerifiedProRegTxHash())) {
return;
}
// keep _verified_ inbound connections
if (pnode->fInbound) {
return;
}
} else if (GetSystemTimeInSeconds() - pnode->nTimeConnected < 5) {
// non-verified, give it some time to verify itself
return;
}
// keep _verified_ inbound connections
if (pnode->fInbound) {
} else if (pnode->qwatch) {
// keep watching nodes
return;
}
} else if (GetSystemTimeInSeconds() - pnode->nTimeConnected < 5) {
// non-verified, give it some time to verify itself
return;
} else if (pnode->qwatch) {
// keep watching nodes
return;
}
// we're not disconnecting masternode probes for at least a few seconds
if (pnode->m_masternode_probe_connection && GetSystemTimeInSeconds() - pnode->nTimeConnected < 5) return;

#ifdef ENABLE_WALLET
bool fFound = ranges::any_of(vecDmns, [&pnode](const auto& dmn){ return pnode->addr == dmn->pdmnState->addr; });
Expand Down

0 comments on commit c0bf54c

Please sign in to comment.