mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Don't disconnect masternode connections when we have less then the desired amount of outbound nodes (#3255)
This commit is contained in:
parent
c1ac9c47c5
commit
a8e7133c65
@ -27,6 +27,17 @@ void CMasternodeUtils::ProcessMasternodeConnections(CConnman& connman)
|
||||
privateSendClient.GetMixingMasternodesInfo(vecDmns);
|
||||
#endif // ENABLE_WALLET
|
||||
|
||||
// Don't disconnect masternode connections when we have less then the desired amount of outbound nodes
|
||||
int nonMasternodeCount = 0;
|
||||
connman.ForEachNode(CConnman::AllNodes, [&](CNode* pnode) {
|
||||
if (!pnode->fInbound && !pnode->fFeeler && !pnode->m_manual_connection && !pnode->fMasternode) {
|
||||
nonMasternodeCount++;
|
||||
}
|
||||
});
|
||||
if (nonMasternodeCount < connman.GetMaxOutboundNodeCount()) {
|
||||
return;
|
||||
}
|
||||
|
||||
connman.ForEachNode(CConnman::AllNodes, [&](CNode* pnode) {
|
||||
if (pnode->fMasternode && !connman.IsMasternodeQuorumNode(pnode)) {
|
||||
#ifdef ENABLE_WALLET
|
||||
|
@ -2924,6 +2924,11 @@ size_t CConnman::GetNodeCount(NumConnections flags)
|
||||
return nNum;
|
||||
}
|
||||
|
||||
size_t CConnman::GetMaxOutboundNodeCount()
|
||||
{
|
||||
return nMaxOutbound;
|
||||
}
|
||||
|
||||
void CConnman::GetNodeStats(std::vector<CNodeStats>& vstats)
|
||||
{
|
||||
vstats.clear();
|
||||
|
@ -407,6 +407,7 @@ public:
|
||||
bool IsMasternodeQuorumNode(const CNode* pnode);
|
||||
|
||||
size_t GetNodeCount(NumConnections num);
|
||||
size_t GetMaxOutboundNodeCount();
|
||||
void GetNodeStats(std::vector<CNodeStats>& vstats);
|
||||
bool DisconnectNode(const std::string& node);
|
||||
bool DisconnectNode(NodeId id);
|
||||
|
Loading…
Reference in New Issue
Block a user