Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ void CActiveMasternode::ManageStatus()
service = CService(strMasterNodeAddr);
}

LogPrintf("CActiveMasternode::ManageStatus() - Checking inbound connection to '%s'\n", service.ToString());

int mainnetDefaultPort = Params(CBaseChainParams::MAIN).GetDefaultPort();
if(Params().NetworkIDString() == CBaseChainParams::MAIN) {
if(service.GetPort() != mainnetDefaultPort) {
Expand All @@ -84,11 +82,15 @@ void CActiveMasternode::ManageStatus()
return;
}

if(!ConnectNode((CAddress)service, NULL, true)){
LogPrintf("CActiveMasternode::ManageStatus() - Checking inbound connection to '%s'\n", service.ToString());

CNode *pnode = ConnectNode((CAddress)service, NULL, false);
if(!pnode){
notCapableReason = "Could not connect to " + service.ToString();
LogPrintf("CActiveMasternode::ManageStatus() - not capable: %s\n", notCapableReason);
return;
}
pnode->Release();

// Choose coins to use
CPubKey pubKeyCollateralAddress;
Expand Down
3 changes: 2 additions & 1 deletion src/darksend-relay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,11 @@ void CDarkSendRelay::RelayThroughNode(int nRank)

if(pmn != NULL){
//printf("RelayThroughNode %s\n", pmn->addr.ToString().c_str());
CNode* pnode = ConnectNode((CAddress)pmn->addr, NULL, true);
CNode* pnode = ConnectNode((CAddress)pmn->addr, NULL, false);
if(pnode){
//printf("Connected\n");
pnode->PushMessage("dsr", (*this));
pnode->Release();
return;
}
} else {
Expand Down
19 changes: 11 additions & 8 deletions src/darksend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1544,20 +1544,23 @@ bool CDarksendPool::DoAutomaticDenominating(bool fDryRun)
std::vector<COutput> vTempCoins2;
// Try to match their denominations if possible
if (!pwalletMain->SelectCoinsByDenominations(dsq.nDenom, nValueMin, nBalanceNeedsAnonymized, vTempCoins, vTempCoins2, nValueIn, 0, nDarksendRounds)){
LogPrintf("DoAutomaticDenominating - Couldn't match denominations %d\n", dsq.nDenom);
LogPrintf("DoAutomaticDenominating --- Couldn't match denominations %d\n", dsq.nDenom);
continue;
}

CMasternode* pmn = mnodeman.Find(dsq.vin);
if(pmn == NULL)
{
LogPrintf("DoAutomaticDenominating --- dsq vin %s is not in masternode list!", dsq.vin.ToString());
continue;
}

LogPrintf("DoAutomaticDenominating --- attempt to connect to masternode from queue %s\n", pmn->addr.ToString());
lastTimeChanged = GetTimeMillis();
// connect to Masternode and submit the queue request
CNode* pnode = ConnectNode((CAddress)addr, NULL, true);
if(pnode != NULL)
{
CMasternode* pmn = mnodeman.Find(dsq.vin);
if(pmn == NULL)
{
LogPrintf("DoAutomaticDenominating --- dsq vin %s is not in masternode list!", dsq.vin.ToString());
continue;
}
pSubmittedToMasternode = pmn;
vecMasternodesUsed.push_back(dsq.vin);
sessionDenom = dsq.nDenom;
Expand Down Expand Up @@ -1599,7 +1602,7 @@ bool CDarksendPool::DoAutomaticDenominating(bool fDryRun)
}

lastTimeChanged = GetTimeMillis();
LogPrintf("DoAutomaticDenominating -- attempt %d connection to Masternode %s\n", i, pmn->addr.ToString());
LogPrintf("DoAutomaticDenominating --- attempt %d connection to Masternode %s\n", i, pmn->addr.ToString());
CNode* pnode = ConnectNode((CAddress)pmn->addr, NULL, true);
if(pnode != NULL){
pSubmittedToMasternode = pmn;
Expand Down
3 changes: 2 additions & 1 deletion src/masternodeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,8 @@ void CMasternodeMan::ProcessMasternodeConnections()
if(pnode->fDarkSendMaster){
if(darkSendPool.pSubmittedToMasternode != NULL && pnode->addr == darkSendPool.pSubmittedToMasternode->addr) continue;
LogPrintf("Closing Masternode connection %s \n", pnode->addr.ToString());
pnode->fDisconnect = true;
pnode->fDarkSendMaster = false;
pnode->Release();
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ class CNode
// b) the peer may tell us in its version message that we should not relay tx invs
// unless it loads a bloom filter.
bool fRelayTxes;
// Should be 'true' only if we connected to this node to actually mix funds.
// In this case node will be released automatically via CMasternodeMan::ProcessMasternodeConnections().
// Connecting to verify connectability/status or connecting for sending/relaying single message
// (even if it's relative to mixing e.g. for blinding) should NOT set this to 'true'.
// For such cases node should be released manually (preferably right after corresponding code).
bool fDarkSendMaster;
CSemaphoreGrant grantOutbound;
CCriticalSection cs_filter;
Expand Down
4 changes: 3 additions & 1 deletion src/rpcmasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ UniValue masternode(const UniValue& params, bool fHelp)

CService addr = CService(strAddress);

if(ConnectNode((CAddress)addr, NULL, true)){
CNode *pnode = ConnectNode((CAddress)addr, NULL, false);
if(pnode){
pnode->Release();
return "successfully connected";
} else {
throw runtime_error("error connecting\n");
Expand Down