mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Skip existing masternode conections on mixing (#1833)
This commit is contained in:
parent
f71ab1daf6
commit
d261575b4f
@ -873,23 +873,19 @@ bool CPrivateSendClient::JoinExistingQueue(CAmount nBalanceNeedsAnonymized, CCon
|
||||
|
||||
vecMasternodesUsed.push_back(dsq.vin.prevout);
|
||||
|
||||
CNode* pnodeFound = NULL;
|
||||
bool fDisconnect = false;
|
||||
connman.ForNode(infoMn.addr, CConnman::AllNodes, [&pnodeFound, &fDisconnect](CNode* pnode) {
|
||||
pnodeFound = pnode;
|
||||
if(pnodeFound->fDisconnect) {
|
||||
fDisconnect = true;
|
||||
} else {
|
||||
pnodeFound->AddRef();
|
||||
}
|
||||
bool fSkip = false;
|
||||
connman.ForNode(infoMn.addr, CConnman::AllNodes, [&fSkip](CNode* pnode) {
|
||||
fSkip = pnode->fDisconnect || pnode->fMasternode;
|
||||
return true;
|
||||
});
|
||||
if (fDisconnect)
|
||||
if (fSkip) {
|
||||
LogPrintf("CPrivateSendClient::JoinExistingQueue -- skipping masternode connection, addr=%s\n", infoMn.addr.ToString());
|
||||
continue;
|
||||
}
|
||||
|
||||
LogPrintf("CPrivateSendClient::JoinExistingQueue -- attempt to connect to masternode from queue, addr=%s\n", infoMn.addr.ToString());
|
||||
// connect to Masternode and submit the queue request
|
||||
CNode* pnode = (pnodeFound && pnodeFound->fMasternode) ? pnodeFound : connman.ConnectNode(CAddress(infoMn.addr, NODE_NETWORK), NULL, true);
|
||||
CNode* pnode = connman.ConnectNode(CAddress(infoMn.addr, NODE_NETWORK), NULL, true);
|
||||
if(pnode) {
|
||||
infoMixingMasternode = infoMn;
|
||||
nSessionDenom = dsq.nDenom;
|
||||
@ -900,9 +896,6 @@ bool CPrivateSendClient::JoinExistingQueue(CAmount nBalanceNeedsAnonymized, CCon
|
||||
strAutoDenomResult = _("Mixing in progress...");
|
||||
SetState(POOL_STATE_QUEUE);
|
||||
nTimeLastSuccessfulStep = GetTimeMillis();
|
||||
if(pnodeFound) {
|
||||
pnodeFound->Release();
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
LogPrintf("CPrivateSendClient::JoinExistingQueue -- can't connect, addr=%s\n", infoMn.addr.ToString());
|
||||
@ -947,24 +940,19 @@ bool CPrivateSendClient::StartNewQueue(CAmount nValueMin, CAmount nBalanceNeedsA
|
||||
continue;
|
||||
}
|
||||
|
||||
CNode* pnodeFound = NULL;
|
||||
bool fDisconnect = false;
|
||||
connman.ForNode(infoMn.addr, CConnman::AllNodes, [&pnodeFound, &fDisconnect](CNode* pnode) {
|
||||
pnodeFound = pnode;
|
||||
if(pnodeFound->fDisconnect) {
|
||||
fDisconnect = true;
|
||||
} else {
|
||||
pnodeFound->AddRef();
|
||||
}
|
||||
bool fSkip = false;
|
||||
connman.ForNode(infoMn.addr, CConnman::AllNodes, [&fSkip](CNode* pnode) {
|
||||
fSkip = pnode->fDisconnect || pnode->fMasternode;
|
||||
return true;
|
||||
});
|
||||
if (fDisconnect) {
|
||||
if (fSkip) {
|
||||
LogPrintf("CPrivateSendClient::StartNewQueue -- skipping masternode connection, addr=%s\n", infoMn.addr.ToString());
|
||||
nTries++;
|
||||
continue;
|
||||
}
|
||||
|
||||
LogPrintf("CPrivateSendClient::StartNewQueue -- attempt %d connection to Masternode %s\n", nTries, infoMn.addr.ToString());
|
||||
CNode* pnode = (pnodeFound && pnodeFound->fMasternode) ? pnodeFound : connman.ConnectNode(CAddress(infoMn.addr, NODE_NETWORK), NULL, true);
|
||||
CNode* pnode = connman.ConnectNode(CAddress(infoMn.addr, NODE_NETWORK), NULL, true);
|
||||
if(pnode) {
|
||||
LogPrintf("CPrivateSendClient::StartNewQueue -- connected, addr=%s\n", infoMn.addr.ToString());
|
||||
infoMixingMasternode = infoMn;
|
||||
@ -982,9 +970,6 @@ bool CPrivateSendClient::StartNewQueue(CAmount nValueMin, CAmount nBalanceNeedsA
|
||||
strAutoDenomResult = _("Mixing in progress...");
|
||||
SetState(POOL_STATE_QUEUE);
|
||||
nTimeLastSuccessfulStep = GetTimeMillis();
|
||||
if(pnodeFound) {
|
||||
pnodeFound->Release();
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
LogPrintf("CPrivateSendClient::StartNewQueue -- can't connect, addr=%s\n", infoMn.addr.ToString());
|
||||
|
Loading…
Reference in New Issue
Block a user