diff --git a/src/net.cpp b/src/net.cpp index a9d02efd6..b47a236e4 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1858,13 +1858,12 @@ void CConnman::ThreadMnbRequestConnections() std::pair > p = mnodeman.PopScheduledMnbRequestConnection(); if(p.first == CService() || p.second.empty()) continue; - CNode* pnode = NULL; - { - LOCK2(cs_main, cs_vNodes); - pnode = ConnectNode(CAddress(p.first, NODE_NETWORK), NULL, true); - if(!pnode) continue; - pnode->AddRef(); - } + ConnectNode(CAddress(p.first, NODE_NETWORK), NULL, true); + + LOCK(cs_vNodes); + + CNode *pnode = FindNode(p.first); + if(!pnode || pnode->fDisconnect) continue; grant.MoveTo(pnode->grantMasternodeOutbound); @@ -1881,8 +1880,6 @@ void CConnman::ThreadMnbRequestConnections() // ask for data PushMessage(pnode, NetMsgType::GETDATA, vToFetch); - - pnode->Release(); } }