mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Don't disconnect masternode probes for a few seconds (#3449)
* Refactor CMasternodeUtils::ProcessMasternodeConnections to be more readable * Don't disconnect masternode probes for a few seconds
This commit is contained in:
parent
608aed3d85
commit
96faa8155e
@ -39,7 +39,15 @@ void CMasternodeUtils::ProcessMasternodeConnections(CConnman& connman)
|
|||||||
}
|
}
|
||||||
|
|
||||||
connman.ForEachNode(CConnman::AllNodes, [&](CNode* pnode) {
|
connman.ForEachNode(CConnman::AllNodes, [&](CNode* pnode) {
|
||||||
if (!pnode->fInbound && pnode->fMasternode && !connman.IsMasternodeQuorumNode(pnode)) {
|
// we're only disconnecting fMasternode connections
|
||||||
|
if (!pnode->fMasternode) return;
|
||||||
|
// we're only disconnecting outbound connections
|
||||||
|
if (pnode->fInbound) return;
|
||||||
|
// we're not disconnecting LLMQ connections
|
||||||
|
if (connman.IsMasternodeQuorumNode(pnode)) return;
|
||||||
|
// we're not disconnecting masternode probes for at least a few seconds
|
||||||
|
if (pnode->fMasternodeProbe && GetSystemTimeInSeconds() - pnode->nTimeConnected < 5) return;
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
bool fFound = false;
|
bool fFound = false;
|
||||||
for (const auto& dmn : vecDmns) {
|
for (const auto& dmn : vecDmns) {
|
||||||
@ -56,7 +64,6 @@ void CMasternodeUtils::ProcessMasternodeConnections(CConnman& connman)
|
|||||||
LogPrintf("Closing Masternode connection: peer=%d\n", pnode->GetId());
|
LogPrintf("Closing Masternode connection: peer=%d\n", pnode->GetId());
|
||||||
}
|
}
|
||||||
pnode->fDisconnect = true;
|
pnode->fDisconnect = true;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user