Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A couple of fixes for CActiveMasternodeManager::Init() #3326

Merged
merged 3 commits into from
Feb 8, 2020
Merged
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
32 changes: 18 additions & 14 deletions src/masternode/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void CActiveMasternodeManager::Init()
// listen option is probably overwritten by something else, no good
state = MASTERNODE_ERROR;
strError = "Masternode must accept connections from outside. Make sure listen configuration option is not overwritten by some another parameter.";
LogPrintf("CActiveDeterministicMasternodeManager::Init -- ERROR: %s\n", strError);
LogPrintf("CActiveMasternodeManager::Init -- ERROR: %s\n", strError);
return;
}

Expand Down Expand Up @@ -107,19 +107,23 @@ void CActiveMasternodeManager::Init()
return;
}

if (Params().NetworkIDString() != CBaseChainParams::REGTEST) {
// Check socket connectivity
LogPrintf("CActiveDeterministicMasternodeManager::Init -- Checking inbound connection to '%s'\n", activeMasternodeInfo.service.ToString());
SOCKET hSocket;
bool fConnected = ConnectSocketDirectly(activeMasternodeInfo.service, hSocket, nConnectTimeout) && IsSelectableSocket(hSocket);
CloseSocket(hSocket);

if (!fConnected) {
state = MASTERNODE_ERROR;
strError = "Could not connect to " + activeMasternodeInfo.service.ToString();
LogPrintf("CActiveDeterministicMasternodeManager::Init -- ERROR: %s\n", strError);
return;
}
// Check socket connectivity
LogPrintf("CActiveMasternodeManager::Init -- Checking inbound connection to '%s'\n", activeMasternodeInfo.service.ToString());
SOCKET hSocket = CreateSocket(activeMasternodeInfo.service);
if (hSocket == INVALID_SOCKET) {
state = MASTERNODE_ERROR;
strError = "Could not create socket to connect to " + activeMasternodeInfo.service.ToString();
LogPrintf("CActiveMasternodeManager::Init -- ERROR: %s\n", strError);
return;
}
bool fConnected = ConnectSocketDirectly(activeMasternodeInfo.service, hSocket, nConnectTimeout) && IsSelectableSocket(hSocket);
CloseSocket(hSocket);

if (!fConnected) {
state = MASTERNODE_ERROR;
strError = "Could not connect to " + activeMasternodeInfo.service.ToString();
LogPrintf("CActiveMasternodeManager::Init -- ERROR: %s\n", strError);
return;
}

activeMasternodeInfo.proTxHash = dmn->proTxHash;
Expand Down