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