enforce mn port on mainnet only

This commit is contained in:
Evan Duffield 2015-02-06 12:41:39 -07:00
parent 012f0e5660
commit c56a54d211
3 changed files with 14 additions and 1 deletions

View File

@ -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<string>(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();

View File

@ -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) {

View File

@ -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