From c56a54d211c211373b27c8fda4133717b69a42f1 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Fri, 6 Feb 2015 12:41:39 -0700 Subject: [PATCH] enforce mn port on mainnet only --- src/activemasternode.cpp | 9 +++++++++ src/masternode.cpp | 4 ++++ src/version.h | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/activemasternode.cpp b/src/activemasternode.cpp index ce825fffc..42adef3d9 100644 --- a/src/activemasternode.cpp +++ b/src/activemasternode.cpp @@ -41,6 +41,15 @@ void CActiveMasternode::ManageStatus() LogPrintf("CActiveMasternode::ManageStatus() - Checking inbound connection to '%s'\n", service.ToString().c_str()); + if(Params().NetworkID() == CChainParams::MAIN){ + if(service.GetPort() != 9999) { + notCapableReason = "Invalid port: " + boost::lexical_cast(service.GetPort()) + " -only 9999 is supported on mainnet."; + status = MASTERNODE_NOT_CAPABLE; + LogPrintf("CActiveMasternode::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); + return; + } + } + if(Params().NetworkID() != CChainParams::REGTEST){ if(!ConnectNode((CAddress)service, service.ToString().c_str())){ notCapableReason = "Could not connect to " + service.ToString(); diff --git a/src/masternode.cpp b/src/masternode.cpp index 6c7df9628..57ffea73b 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -105,6 +105,10 @@ void ProcessMessageMasternode(CNode* pfrom, std::string& strCommand, CDataStream return; } + if(Params().NetworkID() == CChainParams::MAIN){ + if(addr.GetPort() != 9999) return; + } + //search existing masternode list, this is where we update existing masternodes with new dsee broadcasts BOOST_FOREACH(CMasterNode& mn, vecMasternodes) { diff --git a/src/version.h b/src/version.h index 2afd7bc83..4cee8ef5f 100644 --- a/src/version.h +++ b/src/version.h @@ -33,7 +33,7 @@ static const int PROTOCOL_VERSION = 70062; static const int INIT_PROTO_VERSION = 209; // disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION = 70062; //70051 +static const int MIN_PEER_PROTO_VERSION = 70051; // nTime field added to CAddress, starting with this version; // if possible, avoid requesting addresses nodes older than this