Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ OperationResult initMasternode(const std::string& _strMasterNodePrivKey, const s
return errorOut(strprintf(_("Invalid -masternodeaddr address: %s"), strMasterNodeAddr));
}

// Peer port needs to match the masternode public one for IPv4 and IPv6.
// Onion can run in other ports because those are behind a hidden service which has the public port fixed to the default port.
if (nPort != GetListenPort() && !addrTest.IsTor()) {
Comment thread
furszy marked this conversation as resolved.
Outdated
return errorOut(strprintf(_("Invalid -masternodeaddr port %d, isn't the same as the peer port %d"),
nPort, GetListenPort()));
}

CKey key;
CPubKey pubkey;
if (!CMessageSigner::GetKeysFromSecret(_strMasterNodePrivKey, key, pubkey)) {
Expand Down
5 changes: 0 additions & 5 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,11 +1035,6 @@ bool AppInit2()
// Exit early if -masternode=1 and -listen=0
if (gArgs.GetBoolArg("-masternode", DEFAULT_MASTERNODE) && !gArgs.GetBoolArg("-listen", DEFAULT_LISTEN))
return UIError(_("Error: -listen must be true if -masternode is set."));
// Exit early if -masternode=1 and -port is not the default port
if (gArgs.GetBoolArg("-masternode", DEFAULT_MASTERNODE) && (GetListenPort() != Params().GetDefaultPort() && !Params().IsRegTestNet()))
return UIError(strprintf(_("Error: Invalid port %d for running a masternode."), GetListenPort()) + "\n\n" +
strprintf(_("Masternodes are required to run on port %d for %s-net"), Params().GetDefaultPort(), Params().NetworkIDString()));

if (gArgs.GetBoolArg("-benchmark", false))
UIWarning(_("Warning: Unsupported argument -benchmark ignored, use -debug=bench."));

Expand Down
4 changes: 2 additions & 2 deletions test/functional/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -1208,8 +1208,8 @@ def setup_2_masternodes_network(self):
self.stake(1)
time.sleep(3)
self.advance_mocktime(10)
remoteOnePort = p2p_port(self.remoteTwoPos)
remoteTwoPort = p2p_port(self.remoteOnePos)
remoteOnePort = p2p_port(self.remoteOnePos)
remoteTwoPort = p2p_port(self.remoteTwoPos)
self.remoteOne.initmasternode(self.mnOnePrivkey, "127.0.0.1:"+str(remoteOnePort))
self.remoteTwo.initmasternode(self.mnTwoPrivkey, "127.0.0.1:"+str(remoteTwoPort))

Expand Down