mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Use Params().RequireRoutableExternalIP() wherever possible
This commit is contained in:
parent
99414ed754
commit
19e3e8733d
@ -23,7 +23,7 @@ static bool CheckService(const uint256& proTxHash, const ProTx& proTx, CValidati
|
||||
if (!proTx.addr.IsValid()) {
|
||||
return state.DoS(10, false, REJECT_INVALID, "bad-protx-ipaddr");
|
||||
}
|
||||
if (Params().NetworkIDString() != CBaseChainParams::REGTEST && !proTx.addr.IsRoutable()) {
|
||||
if (Params().RequireRoutableExternalIP() && !proTx.addr.IsRoutable()) {
|
||||
return state.DoS(10, false, REJECT_INVALID, "bad-protx-ipaddr");
|
||||
}
|
||||
|
||||
|
@ -1459,7 +1459,7 @@ bool AppInitParameterInteraction()
|
||||
}
|
||||
|
||||
if (gArgs.IsArgSet("-masternodeblsprivkey")) {
|
||||
if (!gArgs.GetBoolArg("-listen", DEFAULT_LISTEN) && Params().NetworkIDString() != CBaseChainParams::REGTEST) {
|
||||
if (!gArgs.GetBoolArg("-listen", DEFAULT_LISTEN) && Params().RequireRoutableExternalIP()) {
|
||||
return InitError("Masternode must accept connections from outside, set -listen=1");
|
||||
}
|
||||
if (!gArgs.GetBoolArg("-txindex", DEFAULT_TXINDEX)) {
|
||||
|
@ -68,7 +68,7 @@ void CActiveMasternodeManager::Init(const CBlockIndex* pindex)
|
||||
if (!deterministicMNManager->IsDIP3Enforced(pindex->nHeight)) return;
|
||||
|
||||
// Check that our local network configuration is correct
|
||||
if (!fListen && Params().NetworkIDString() != CBaseChainParams::REGTEST) {
|
||||
if (!fListen && Params().RequireRoutableExternalIP()) {
|
||||
// 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.";
|
||||
@ -119,7 +119,7 @@ void CActiveMasternodeManager::Init(const CBlockIndex* pindex)
|
||||
bool fConnected = ConnectSocketDirectly(activeMasternodeInfo.service, hSocket, nConnectTimeout) && IsSelectableSocket(hSocket);
|
||||
CloseSocket(hSocket);
|
||||
|
||||
if (!fConnected && Params().NetworkIDString() != CBaseChainParams::REGTEST) {
|
||||
if (!fConnected && Params().RequireRoutableExternalIP()) {
|
||||
state = MASTERNODE_ERROR;
|
||||
strError = "Could not connect to " + activeMasternodeInfo.service.ToString();
|
||||
LogPrintf("CActiveMasternodeManager::Init -- ERROR: %s\n", strError);
|
||||
@ -190,7 +190,7 @@ bool CActiveMasternodeManager::GetLocalAddress(CService& addrRet)
|
||||
if (LookupHost("8.8.8.8", addrDummyPeer, false)) {
|
||||
fFoundLocal = GetLocal(addrRet, &addrDummyPeer) && IsValidNetAddr(addrRet);
|
||||
}
|
||||
if (!fFoundLocal && Params().NetworkIDString() == CBaseChainParams::REGTEST) {
|
||||
if (!fFoundLocal && !Params().RequireRoutableExternalIP()) {
|
||||
if (Lookup("127.0.0.1", addrRet, GetListenPort(), false)) {
|
||||
fFoundLocal = true;
|
||||
}
|
||||
@ -218,6 +218,6 @@ bool CActiveMasternodeManager::IsValidNetAddr(CService addrIn)
|
||||
{
|
||||
// TODO: regtest is fine with any addresses for now,
|
||||
// should probably be a bit smarter if one day we start to implement tests for this
|
||||
return Params().NetworkIDString() == CBaseChainParams::REGTEST ||
|
||||
return !Params().RequireRoutableExternalIP() ||
|
||||
(addrIn.IsIPv4() && IsReachable(addrIn) && addrIn.IsRoutable());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user