Skip to content

Commit

Permalink
fix: rename ipAndPort to generic hostnameAndPort
Browse files Browse the repository at this point in the history
  • Loading branch information
coolaj86 committed Mar 1, 2024
1 parent 3b7deea commit 5b08d0f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
29 changes: 15 additions & 14 deletions src/rpc/evo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,15 @@ static RPCArg GetRpcArg(const std::string& strParamName)
"If not specified, payoutAddress is the one that is going to be used.\n"
"The private key belonging to this address must be known in your wallet."}
},
{"ipAndPort",
{"ipAndPort", RPCArg::Type::STR, RPCArg::Optional::NO,
"IP and port in the form \"IP:PORT\". Must be unique on the network.\n"
// ip or hostname, and port
{"hostnameAndPort",
{"hostnameAndPort", RPCArg::Type::STR, RPCArg::Optional::NO,
"Host in the form \"HOSTNAME:PORT\". Must be unique on the network.\n"
"Can be set to an empty string, which will require a ProUpServTx afterwards."}
},
{"ipAndPort_update",
{"ipAndPort", RPCArg::Type::STR, RPCArg::Optional::NO,
"IP and port in the form \"IP:PORT\". Must be unique on the network."}
{"hostnameAndPort_update",
{"hostnameAndPort", RPCArg::Type::STR, RPCArg::Optional::NO,
"Host in the form \"HOSTNAME:PORT\". Must be unique on the network."}
},
{"operatorKey",
{"operatorKey", RPCArg::Type::STR, RPCArg::Optional::NO,
Expand Down Expand Up @@ -367,7 +368,7 @@ static void protx_register_fund_help(const JSONRPCRequest& request, bool legacy)
+ HELP_REQUIRING_PASSPHRASE,
{
GetRpcArg("collateralAddress"),
GetRpcArg("ipAndPort"),
GetRpcArg("hostnameAndPort"),
GetRpcArg("ownerAddress"),
legacy ? GetRpcArg("operatorPubKey_register_legacy") : GetRpcArg("operatorPubKey_register"),
GetRpcArg("votingAddress_register"),
Expand Down Expand Up @@ -402,7 +403,7 @@ static void protx_register_help(const JSONRPCRequest& request, bool legacy)
{
GetRpcArg("collateralHash"),
GetRpcArg("collateralIndex"),
GetRpcArg("ipAndPort"),
GetRpcArg("hostnameAndPort"),
GetRpcArg("ownerAddress"),
legacy ? GetRpcArg("operatorPubKey_register_legacy") : GetRpcArg("operatorPubKey_register"),
GetRpcArg("votingAddress_register"),
Expand Down Expand Up @@ -436,7 +437,7 @@ static void protx_register_prepare_help(const JSONRPCRequest& request, bool lega
{
GetRpcArg("collateralHash"),
GetRpcArg("collateralIndex"),
GetRpcArg("ipAndPort"),
GetRpcArg("hostnameAndPort"),
GetRpcArg("ownerAddress"),
legacy ? GetRpcArg("operatorPubKey_register_legacy") : GetRpcArg("operatorPubKey_register"),
GetRpcArg("votingAddress_register"),
Expand Down Expand Up @@ -489,7 +490,7 @@ static void protx_register_fund_evo_help(const JSONRPCRequest& request)
HELP_REQUIRING_PASSPHRASE,
{
GetRpcArg("collateralAddress"),
GetRpcArg("ipAndPort"),
GetRpcArg("hostnameAndPort"),
GetRpcArg("ownerAddress"),
GetRpcArg("operatorPubKey_register"),
GetRpcArg("votingAddress_register"),
Expand Down Expand Up @@ -523,7 +524,7 @@ static void protx_register_evo_help(const JSONRPCRequest& request)
{
GetRpcArg("collateralHash"),
GetRpcArg("collateralIndex"),
GetRpcArg("ipAndPort"),
GetRpcArg("hostnameAndPort"),
GetRpcArg("ownerAddress"),
GetRpcArg("operatorPubKey_register"),
GetRpcArg("votingAddress_register"),
Expand Down Expand Up @@ -556,7 +557,7 @@ static void protx_register_prepare_evo_help(const JSONRPCRequest& request)
{
GetRpcArg("collateralHash"),
GetRpcArg("collateralIndex"),
GetRpcArg("ipAndPort"),
GetRpcArg("hostnameAndPort"),
GetRpcArg("ownerAddress"),
GetRpcArg("operatorPubKey_register"),
GetRpcArg("votingAddress_register"),
Expand Down Expand Up @@ -856,7 +857,7 @@ static void protx_update_service_help(const JSONRPCRequest& request)
+ HELP_REQUIRING_PASSPHRASE,
{
GetRpcArg("proTxHash"),
GetRpcArg("ipAndPort_update"),
GetRpcArg("hostnameAndPort_update"),
GetRpcArg("operatorKey"),
GetRpcArg("operatorPayoutAddress"),
GetRpcArg("feeSourceAddress"),
Expand All @@ -880,7 +881,7 @@ static void protx_update_service_evo_help(const JSONRPCRequest& request)
HELP_REQUIRING_PASSPHRASE,
{
GetRpcArg("proTxHash"),
GetRpcArg("ipAndPort_update"),
GetRpcArg("hostnameAndPort_update"),
GetRpcArg("operatorKey"),
GetRpcArg("platformNodeID"),
GetRpcArg("platformP2PPort"),
Expand Down
4 changes: 2 additions & 2 deletions test/functional/feature_llmq_evo.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ def test_evo_is_rejected_before_v19(self):
break
assert collateral_vout is not None

ipAndPort = '127.0.0.1:%d' % p2p_port(len(self.nodes))
hostnameAndPort = 'localhost:%d' % p2p_port(len(self.nodes))
operatorReward = len(self.nodes)

try:
self.nodes[0].protx('register_evo', collateral_txid, collateral_vout, ipAndPort, owner_address, bls['public'], voting_address, operatorReward, reward_address, funds_address, True)
self.nodes[0].protx('register_evo', collateral_txid, collateral_vout, hostnameAndPort, owner_address, bls['public'], voting_address, operatorReward, reward_address, funds_address, True)
# this should never succeed
assert False
except:
Expand Down
18 changes: 9 additions & 9 deletions test/functional/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,21 +1223,21 @@ def dynamically_prepare_masternode(self, idx, node_p2p_port, evo=False, rnd=None
break
assert collateral_vout is not None

ipAndPort = '127.0.0.1:%d' % node_p2p_port
hostnameAndPort = 'localhost:%d' % node_p2p_port
operatorReward = idx

protx_result = None
if evo:
protx_result = self.nodes[0].protx("register_evo", collateral_txid, collateral_vout, ipAndPort, owner_address, bls['public'], voting_address, operatorReward, reward_address, platform_node_id, platform_p2p_port, platform_http_port, funds_address, True)
protx_result = self.nodes[0].protx("register_evo", collateral_txid, collateral_vout, hostnameAndPort, owner_address, bls['public'], voting_address, operatorReward, reward_address, platform_node_id, platform_p2p_port, platform_http_port, funds_address, True)
else:
protx_result = self.nodes[0].protx("register", collateral_txid, collateral_vout, ipAndPort, owner_address, bls['public'], voting_address, operatorReward, reward_address, funds_address, True)
protx_result = self.nodes[0].protx("register", collateral_txid, collateral_vout, hostnameAndPort, owner_address, bls['public'], voting_address, operatorReward, reward_address, funds_address, True)

self.wait_for_instantlock(protx_result, self.nodes[0])
tip = self.nodes[0].generate(1)[0]
self.sync_all(self.nodes)

assert_equal(self.nodes[0].getrawtransaction(protx_result, 1, tip)['confirmations'], 1)
mn_info = MasternodeInfo(protx_result, owner_address, voting_address, reward_address, operatorReward, bls['public'], bls['secret'], collateral_address, collateral_txid, collateral_vout, ipAndPort, evo)
mn_info = MasternodeInfo(protx_result, owner_address, voting_address, reward_address, operatorReward, bls['public'], bls['secret'], collateral_address, collateral_txid, collateral_vout, hostnameAndPort, evo)
self.mninfo.append(mn_info)

mn_type_str = "EvoNode" if evo else "MN"
Expand Down Expand Up @@ -1307,16 +1307,16 @@ def prepare_masternode(self, idx):
votingAddr = ownerAddr

port = p2p_port(len(self.nodes) + idx)
ipAndPort = '127.0.0.1:%d' % port
hostnameAndPort = 'localhost:%d' % port
operatorReward = idx

submit = (idx % 4) < 2

if register_fund:
protx_result = self.nodes[0].protx('register_fund', address, ipAndPort, ownerAddr, bls['public'], votingAddr, operatorReward, rewardsAddr, address, submit)
protx_result = self.nodes[0].protx('register_fund', address, hostnameAndPort, ownerAddr, bls['public'], votingAddr, operatorReward, rewardsAddr, address, submit)
else:
self.nodes[0].generate(1)
protx_result = self.nodes[0].protx('register', txid, collateral_vout, ipAndPort, ownerAddr, bls['public'], votingAddr, operatorReward, rewardsAddr, address, submit)
protx_result = self.nodes[0].protx('register', txid, collateral_vout, hostnameAndPort, ownerAddr, bls['public'], votingAddr, operatorReward, rewardsAddr, address, submit)

if submit:
proTxHash = protx_result
Expand All @@ -1326,9 +1326,9 @@ def prepare_masternode(self, idx):
if operatorReward > 0:
self.nodes[0].generate(1)
operatorPayoutAddress = self.nodes[0].getnewaddress()
self.nodes[0].protx('update_service', proTxHash, ipAndPort, bls['secret'], operatorPayoutAddress, address)
self.nodes[0].protx('update_service', proTxHash, hostnameAndPort, bls['secret'], operatorPayoutAddress, address)

self.mninfo.append(MasternodeInfo(proTxHash, ownerAddr, votingAddr, rewardsAddr, operatorReward, bls['public'], bls['secret'], address, txid, collateral_vout, ipAndPort, False))
self.mninfo.append(MasternodeInfo(proTxHash, ownerAddr, votingAddr, rewardsAddr, operatorReward, bls['public'], bls['secret'], address, txid, collateral_vout, hostnameAndPort, False))

self.log.info("Prepared MN %d: collateral_txid=%s, collateral_vout=%d, protxHash=%s" % (idx, txid, collateral_vout, proTxHash))

Expand Down

0 comments on commit 5b08d0f

Please sign in to comment.