Don't disconnect masternode connections when we have less then the desired amount of outbound nodes (#3255)
This commit is contained in:
parent
cecbbab3cd
commit
31afa9c0fc
@ -27,6 +27,17 @@ void CMasternodeUtils::ProcessMasternodeConnections(CConnman& connman)
|
|||||||
privateSendClient.GetMixingMasternodesInfo(vecDmns);
|
privateSendClient.GetMixingMasternodesInfo(vecDmns);
|
||||||
#endif // ENABLE_WALLET
|
#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) {
|
connman.ForEachNode(CConnman::AllNodes, [&](CNode* pnode) {
|
||||||
if (pnode->fMasternode && !connman.IsMasternodeQuorumNode(pnode)) {
|
if (pnode->fMasternode && !connman.IsMasternodeQuorumNode(pnode)) {
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
|
@ -2924,6 +2924,11 @@ size_t CConnman::GetNodeCount(NumConnections flags)
|
|||||||
return nNum;
|
return nNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t CConnman::GetMaxOutboundNodeCount()
|
||||||
|
{
|
||||||
|
return nMaxOutbound;
|
||||||
|
}
|
||||||
|
|
||||||
void CConnman::GetNodeStats(std::vector<CNodeStats>& vstats)
|
void CConnman::GetNodeStats(std::vector<CNodeStats>& vstats)
|
||||||
{
|
{
|
||||||
vstats.clear();
|
vstats.clear();
|
||||||
|
@ -407,6 +407,7 @@ public:
|
|||||||
bool IsMasternodeQuorumNode(const CNode* pnode);
|
bool IsMasternodeQuorumNode(const CNode* pnode);
|
||||||
|
|
||||||
size_t GetNodeCount(NumConnections num);
|
size_t GetNodeCount(NumConnections num);
|
||||||
|
size_t GetMaxOutboundNodeCount();
|
||||||
void GetNodeStats(std::vector<CNodeStats>& vstats);
|
void GetNodeStats(std::vector<CNodeStats>& vstats);
|
||||||
bool DisconnectNode(const std::string& node);
|
bool DisconnectNode(const std::string& node);
|
||||||
bool DisconnectNode(NodeId id);
|
bool DisconnectNode(NodeId id);
|
||||||
|
Loading…
Reference in New Issue
Block a user