Skip to content

Commit

Permalink
enforce mn port on mainnet only
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Duffield committed Feb 6, 2015
1 parent 012f0e5 commit c56a54d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions src/masternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c56a54d

Please sign in to comment.