diff --git a/src/evo/mnauth.cpp b/src/evo/mnauth.cpp index 03f566d7ba..2047cfbd40 100644 --- a/src/evo/mnauth.cpp +++ b/src/evo/mnauth.cpp @@ -67,6 +67,13 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS return; } + if ((~pnode->nServices) & (NODE_NETWORK | NODE_BLOOM)) { + // either NODE_NETWORK or NODE_BLOOM bit is missiing in node's services + LOCK(cs_main); + Misbehaving(pnode->GetId(), 100, "mnauth from a node with invalid services"); + return; + } + if (mnauth.proRegTxHash.IsNull()) { LOCK(cs_main); Misbehaving(pnode->GetId(), 100, "empty mnauth proRegTxHash"); diff --git a/src/init.cpp b/src/init.cpp index aceb2c6c3b..c55913741e 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -902,23 +902,6 @@ void InitParameterInteraction() LogPrintf("%s: parameter interaction: -whitebind set -> setting -listen=1\n", __func__); } - if (gArgs.IsArgSet("-masternodeblsprivkey")) { - // masternodes MUST accept connections from outside - gArgs.ForceSetArg("-listen", "1"); - LogPrintf("%s: parameter interaction: -masternodeblsprivkey=... -> setting -listen=1\n", __func__); -#ifdef ENABLE_WALLET - // masternode should not have wallet enabled - gArgs.ForceSetArg("-disablewallet", "1"); - LogPrintf("%s: parameter interaction: -masternodeblsprivkey=... -> setting -disablewallet=1\n", __func__); -#endif // ENABLE_WALLET - if (gArgs.GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS) < DEFAULT_MAX_PEER_CONNECTIONS) { - // masternodes MUST be able to handle at least DEFAULT_MAX_PEER_CONNECTIONS connections - gArgs.ForceSetArg("-maxconnections", itostr(DEFAULT_MAX_PEER_CONNECTIONS)); - LogPrintf("%s: parameter interaction: -masternodeblsprivkey=... -> setting -maxconnections=%d instead of specified -maxconnections=%d\n", - __func__, DEFAULT_MAX_PEER_CONNECTIONS, gArgs.GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS)); - } - } - if (gArgs.IsArgSet("-connect")) { // when only connecting to trusted nodes, do not seed via DNS, or listen by default if (gArgs.SoftSetBoolArg("-dnsseed", false)) @@ -1458,6 +1441,27 @@ bool AppInitParameterInteraction() InitWarning(_("-masternode option is deprecated and ignored, specifying -masternodeblsprivkey is enough to start this node as a masternode.")); } + if (gArgs.IsArgSet("-masternodeblsprivkey")) { + if (!gArgs.GetBoolArg("-listen", DEFAULT_LISTEN)) { + return InitError("Masternode must accept connections from outside, set -listen=1"); + } + if (!gArgs.GetBoolArg("-txindex", DEFAULT_TXINDEX)) { + return InitError("Masternode must have transaction index enabled, set -txindex=1"); + } + if (!gArgs.GetBoolArg("-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS)) { + return InitError("Masternode must have bloom filters enabled, set -peerbloomfilters=1"); + } + if (gArgs.GetArg("-prune", 0) > 0) { + return InitError("Masternode must have no pruning enabled, set -prune=0"); + } + if (gArgs.GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS) < DEFAULT_MAX_PEER_CONNECTIONS) { + return InitError(strprintf("Masternode must be able to handle at least %d connections, set -maxconnections=%d", DEFAULT_MAX_PEER_CONNECTIONS, DEFAULT_MAX_PEER_CONNECTIONS)); + } + if (gArgs.GetBoolArg("-litemode", false)) { + return InitError(_("You can not start a masternode in lite mode.")); + } + } + return true; } @@ -2043,16 +2047,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) LogPrintf(" blsPubKeyOperator: %s\n", keyOperator.GetPublicKey().ToString()); } - if(fLiteMode && fMasternodeMode) { - return InitError(_("You can not start a masternode in lite mode.")); - } - if(fMasternodeMode) { -#ifdef ENABLE_WALLET - if (!vpwallets.empty()) { - return InitError(_("You can not start a masternode with wallet enabled.")); - } -#endif //ENABLE_WALLET // Create and register activeMasternodeManager, will init later in ThreadImport activeMasternodeManager = new CActiveMasternodeManager(); RegisterValidationInterface(activeMasternodeManager); diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index f63b151567..878afb5173 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -66,12 +66,18 @@ std::string GetWalletHelpString(bool showDebug) bool WalletParameterInteraction() { + if (gArgs.IsArgSet("-masternodeblsprivkey") && gArgs.SoftSetBoolArg("-disablewallet", true)) { + LogPrintf("%s: parameter interaction: -masternodeblsprivkey set -> setting -disablewallet=1\n", __func__); + } + if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) { for (const std::string& wallet : gArgs.GetArgs("-wallet")) { LogPrintf("%s: parameter interaction: -disablewallet -> ignoring -wallet=%s\n", __func__, wallet); } return true; + } else if (gArgs.IsArgSet("-masternodeblsprivkey")) { + return InitError(_("You can not start a masternode with wallet enabled.")); } gArgs.SoftSetArg("-wallet", DEFAULT_WALLET_DAT);