Skip to content

Commit 47403f2

Browse files
committed
Fix tests
1 parent 4679799 commit 47403f2

File tree

5 files changed

+43
-43
lines changed

5 files changed

+43
-43
lines changed

doc/release-notes/draft-release-notes-6.0.0.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ Upgrade instructions: !TODO
115115
"txid" (string) The transaction id.
116116
```
117117
118-
* `preprareprotxregistration`
118+
* `prepareprotxregistration`
119119
```
120-
preprareprotxregistration "collateralHash" collateralIndex "ipAndPort" "ownerAddress" "operatorPubKey" "votingAddress" "payoutAddress" (operatorReward "operatorPayoutAddress")
120+
prepareprotxregistration "collateralHash" collateralIndex "ipAndPort" "ownerAddress" "operatorPubKey" "votingAddress" "payoutAddress" (operatorReward "operatorPayoutAddress")
121121
122122
Creates an unsigned ProTx and returns it. The ProTx must be signed externally with the collateral
123123
key and then passed to "submitprotxregistration".
@@ -156,10 +156,10 @@ Upgrade instructions: !TODO
156156
submitprotxregistration "tx" "sig"
157157
158158
Submits the specified ProTx to the network. This command will also sign the inputs of the transaction
159-
which were previously added by "preprareprotxregistration" to cover transaction fees
159+
which were previously added by "prepareprotxregistration" to cover transaction fees
160160
161161
Arguments:
162-
1. "tx" (string, required) The serialized transaction previously returned by "preprareprotxregistration"
162+
1. "tx" (string, required) The serialized transaction previously returned by "prepareprotxregistration"
163163
2. "sig" (string, required) The signature signed with the collateral key. Must be in base64 format.
164164
165165
Result:

src/rpc/rpcevo.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ static ProRegPL ParseProRegPLParams(const UniValue& params, unsigned int paramId
314314
return pl;
315315
}
316316

317-
// handles registerprotx, and preprareprotxregistration
317+
// handles registerprotx, and prepareprotxregistration
318318
static UniValue ProTxRegister(const JSONRPCRequest& request, bool fSignAndSend)
319319
{
320320
CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
@@ -329,7 +329,7 @@ static UniValue ProTxRegister(const JSONRPCRequest& request, bool fSignAndSend)
329329
"The collateral is specified through \"collateralHash\" and \"collateralIndex\" and must be an unspent\n"
330330
"transaction output spendable by this wallet. It must also not be used by any other masternode.\n"
331331
:
332-
"preprareprotxregistration \"collateralHash\" collateralIndex \"ipAndPort\" \"ownerAddress\" \"operatorPubKey\" \"votingAddress\" \"payoutAddress\" (operatorReward \"operatorPayoutAddress\")\n"
332+
"prepareprotxregistration \"collateralHash\" collateralIndex \"ipAndPort\" \"ownerAddress\" \"operatorPubKey\" \"votingAddress\" \"payoutAddress\" (operatorReward \"operatorPayoutAddress\")\n"
333333
"\nCreates an unsigned ProTx and returns it. The ProTx must be signed externally with the collateral\n"
334334
"key and then passed to \"submitprotxregistration\".\n"
335335
"The collateral is specified through \"collateralHash\" and \"collateralIndex\" and must be an unspent transaction output.\n"
@@ -357,7 +357,7 @@ static UniValue ProTxRegister(const JSONRPCRequest& request, bool fSignAndSend)
357357
" \"signMessage\" : (string) The string message that needs to be signed with the collateral key\n"
358358
"}\n"
359359
"\nExamples:\n"
360-
+ HelpExampleCli("preprareprotxregistration", "\"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\" 0 \"168.192.1.100:51472\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\"")
360+
+ HelpExampleCli("prepareprotxregistration", "\"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\" 0 \"168.192.1.100:51472\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\"")
361361
)
362362
)
363363
);
@@ -427,7 +427,7 @@ UniValue registerprotx(const JSONRPCRequest& request)
427427
return ProTxRegister(request, true);
428428
}
429429

430-
UniValue preprareprotxregistration(const JSONRPCRequest& request)
430+
UniValue prepareprotxregistration(const JSONRPCRequest& request)
431431
{
432432
return ProTxRegister(request, false);
433433
}
@@ -443,10 +443,10 @@ UniValue submitprotxregistration(const JSONRPCRequest& request)
443443
throw std::runtime_error(
444444
"submitprotxregistration \"tx\" \"sig\"\n"
445445
"\nSubmits the specified ProTx to the network. This command will also sign the inputs of the transaction\n"
446-
"which were previously added by \"preprareprotxregistration\" to cover transaction fees\n"
446+
"which were previously added by \"prepareprotxregistration\" to cover transaction fees\n"
447447
+ HelpRequiringPassphrase(pwallet) + "\n"
448448
"\nArguments:\n"
449-
"1. \"tx\" (string, required) The serialized transaction previously returned by \"preprareprotxregistration\"\n"
449+
"1. \"tx\" (string, required) The serialized transaction previously returned by \"prepareprotxregistration\"\n"
450450
"2. \"sig\" (string, required) The signature signed with the collateral key. Must be in base64 format.\n"
451451
"\nResult:\n"
452452
"\"txid\" (string) The transaction id.\n"
@@ -947,7 +947,7 @@ static const CRPCCommand commands[] =
947947
#ifdef ENABLE_WALLET
948948
{ "evo", "registerprotx", &registerprotx, true, {"collateralHash","collateralIndex","ipAndPort","ownerAddress","operatorPubKey","votingAddress","payoutAddress","operatorReward","operatorPayoutAddress"} },
949949
{ "evo", "fundprotxregistration", &fundprotxregistration, true, {"collateralAddress","ipAndPort","ownerAddress","operatorPubKey","votingAddress","payoutAddress","operatorReward","operatorPayoutAddress"} },
950-
{ "evo", "preprareprotxregistration", &preprareprotxregistration, true, {"collateralHash","collateralIndex","ipAndPort","ownerAddress","operatorPubKey","votingAddress","payoutAddress","operatorReward","operatorPayoutAddress"} },
950+
{ "evo", "prepareprotxregistration", &prepareprotxregistration, true, {"collateralHash","collateralIndex","ipAndPort","ownerAddress","operatorPubKey","votingAddress","payoutAddress","operatorReward","operatorPayoutAddress"} },
951951
{ "evo", "submitprotxregistration", &submitprotxregistration, true, {"tx","sig"} },
952952
{ "evo", "revokeprotx", &revokeprotx, true, {"proTxHash","operatorKey","reason"} },
953953
{ "evo", "updateprotxregistrar", &updateprotxregistrar, true, {"proTxHash","operatorPubKey","votingAddress","payoutAddress","ownerKey"} },

test/functional/test_framework/test_framework.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,7 @@ def setupDMN(self,
10791079
self.stake_and_sync(self.nodes.index(miner), 1)
10801080
assert_greater_than(mnOwner.getrawtransaction(fundingTxId, 1)["confirmations"], 0)
10811081
# create and send the ProRegTx funding the collateral
1082-
proTxId = mnOwner.fundprotxregistration(collateralAdd, ipport, ownerAdd,
1082+
proTxId = mnOwner.fund_protx_registration(collateralAdd, ipport, ownerAdd,
10831083
bls_keypair["public"], votingAdd, collateralAdd)
10841084
elif strType == "internal":
10851085
mnOwner.getnewaddress("dust")
@@ -1096,13 +1096,13 @@ def setupDMN(self,
10961096
break
10971097
assert_greater_than(collateralTxId_n, -1)
10981098
assert_greater_than(json_tx["confirmations"], 0)
1099-
proTxId = mnOwner.registerprotx(collateralTxId, collateralTxId_n, ipport, ownerAdd,
1099+
proTxId = mnOwner.register_protx(collateralTxId, collateralTxId_n, ipport, ownerAdd,
11001100
bls_keypair["public"], votingAdd, collateralAdd)
11011101
elif strType == "external":
11021102
self.log.info("Setting up ProRegTx with collateral externally-signed...")
11031103
# send the tx from the miner
11041104
payoutAdd = mnOwner.getnewaddress("payout")
1105-
register_res = miner.preprareprotxregistration(outpoint.hash, outpoint.n, ipport, ownerAdd,
1105+
register_res = miner.prepareprotxregistration(outpoint.hash, outpoint.n, ipport, ownerAdd,
11061106
bls_keypair["public"], votingAdd, payoutAdd)
11071107
self.log.info("ProTx prepared")
11081108
message_to_sign = register_res["signMessage"]
@@ -1175,7 +1175,7 @@ def not_found():
11751175
"""
11761176
Create a ProReg tx, which has the collateral as one of its outputs
11771177
"""
1178-
def fundprotxregistration(self, miner, controller, dmn, collateral_addr, op_rew=None):
1178+
def fund_protx_registration(self, miner, controller, dmn, collateral_addr, op_rew=None):
11791179
# send to the owner the collateral tx + some dust for the ProReg and fee
11801180
funding_txid = miner.sendtoaddress(collateral_addr, Decimal('101'))
11811181
# confirm and verify reception
@@ -1197,7 +1197,7 @@ def fundprotxregistration(self, miner, controller, dmn, collateral_addr, op_rew=
11971197
Create a ProReg tx, which references an 100 PIV UTXO as collateral.
11981198
The controller node owns the collateral and creates the ProReg tx.
11991199
"""
1200-
def registerprotx(self, miner, controller, dmn, collateral_addr):
1200+
def register_protx(self, miner, controller, dmn, collateral_addr):
12011201
# send to the owner the exact collateral tx amount
12021202
funding_txid = miner.sendtoaddress(collateral_addr, Decimal('100'))
12031203
# send another output to be used for the fee of the proReg tx
@@ -1216,7 +1216,7 @@ def registerprotx(self, miner, controller, dmn, collateral_addr):
12161216
Create a ProReg tx, referencing a collateral signed externally (eg. HW wallets).
12171217
Here the controller node owns the collateral (and signs), but the miner creates the ProReg tx.
12181218
"""
1219-
def registerprotx_ext(self, miner, controller, dmn, outpoint, fSubmit):
1219+
def register_protx_ext(self, miner, controller, dmn, outpoint, fSubmit):
12201220
# send to the owner the collateral tx if the outpoint is not specified
12211221
if outpoint is None:
12221222
funding_txid = miner.sendtoaddress(controller.getnewaddress("collateral"), Decimal('100'))
@@ -1228,7 +1228,7 @@ def registerprotx_ext(self, miner, controller, dmn, outpoint, fSubmit):
12281228
outpoint = COutPoint(int(funding_txid, 16), get_collateral_vout(json_tx))
12291229
dmn.collateral = outpoint
12301230
# Prepare the message to be signed externally by the owner of the collateral (the controller)
1231-
reg_tx = miner.preprareprotxregistration("%064x" % outpoint.hash, outpoint.n, dmn.ipport, dmn.owner,
1231+
reg_tx = miner.prepareprotxregistration("%064x" % outpoint.hash, outpoint.n, dmn.ipport, dmn.owner,
12321232
dmn.operator_pk, dmn.voting, dmn.payee)
12331233
sig = controller.signmessage(reg_tx["collateralAddress"], reg_tx["signMessage"])
12341234
if fSubmit:
@@ -1268,11 +1268,11 @@ def register_new_dmn(self, idx, miner_idx, controller_idx, strType,
12681268
self.log.info("Creating%s proRegTx for deterministic masternode idx=%d..." % (
12691269
" and funding" if strType == "fund" else "", idx))
12701270
if strType == "fund":
1271-
self.fundprotxregistration(miner_node, controller_node, dmn, collateral_addr)
1271+
self.fund_protx_registration(miner_node, controller_node, dmn, collateral_addr)
12721272
elif strType == "internal":
1273-
self.registerprotx(miner_node, controller_node, dmn, collateral_addr)
1273+
self.register_protx(miner_node, controller_node, dmn, collateral_addr)
12741274
elif strType == "external":
1275-
self.registerprotx_ext(miner_node, controller_node, dmn, outpoint, True)
1275+
self.register_protx_ext(miner_node, controller_node, dmn, outpoint, True)
12761276
else:
12771277
raise Exception("Type %s not available" % strType)
12781278
time.sleep(1)

test/functional/tiertwo_deterministicmns.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def run_test(self):
122122
assert_raises_rpc_error(-1, "Evo upgrade is not active yet", self.add_new_dmn, mns, "fund")
123123
# Can create the raw proReg
124124
dmn = create_new_dmn(2, controller, dummy_add, None)
125-
tx, sig = self.registerprotx_ext(miner, controller, dmn, None, False)
125+
tx, sig = self.register_protx_ext(miner, controller, dmn, None, False)
126126
# but cannot send it
127127
assert_raises_rpc_error(-1, "Evo upgrade is not active yet", miner.submitprotxregistration, tx, sig)
128128
self.log.info("Done. Now mine blocks till enforcement...")
@@ -233,20 +233,20 @@ def run_test(self):
233233
self.log.info("Trying duplicate operator key...")
234234
dmn2b = create_new_dmn(dmn2.idx, controller, dummy_add, dmn_keys)
235235
assert_raises_rpc_error(RPC_VERIFY_REJECTED, "bad-protx-dup-operator-key",
236-
self.fundprotxregistration, miner, controller, dmn2b, dummy_add)
236+
self.fund_protx_registration, miner, controller, dmn2b, dummy_add)
237237

238238
# Now try with duplicate owner key
239239
self.log.info("Trying duplicate owner key...")
240240
dmn2c = create_new_dmn(dmn2.idx, controller, dummy_add, dmn2_keys)
241241
dmn2c.owner = mns[randrange(len(mns))].owner
242242
assert_raises_rpc_error(RPC_VERIFY_REJECTED, "bad-protx-dup-owner-key",
243-
self.fundprotxregistration, miner, controller, dmn2c, dummy_add)
243+
self.fund_protx_registration, miner, controller, dmn2c, dummy_add)
244244

245245
# Finally, register it properly. This time setting 10% of the reward for the operator
246246
op_rew = {"reward": 10.00, "address": self.nodes[dmn2.idx].getnewaddress()}
247247
self.log.info("Reactivating the node with a new registration (with operator reward)...")
248248
dmn2c = create_new_dmn(dmn2.idx, controller, dummy_add, dmn2_keys)
249-
self.fundprotxregistration(miner, controller, dmn2c, dummy_add, op_rew)
249+
self.fund_protx_registration(miner, controller, dmn2c, dummy_add, op_rew)
250250
mns.append(dmn2c)
251251
time.sleep(1)
252252
self.sync_mempools([miner, controller])
@@ -314,7 +314,7 @@ def run_test(self):
314314
miner.generate(1)
315315
self.sync_blocks()
316316
# Then send the ProUpServ tx from the masternode
317-
remote_node.updateprotxservice(mns[0].proTx, mns[0].ipport)
317+
remote_node.update_protx_service(mns[0].proTx, mns[0].ipport)
318318
self.sync_mempools([miner, remote_node])
319319
miner.generate(1)
320320
self.sync_blocks()
@@ -334,17 +334,17 @@ def run_test(self):
334334
assert_raises_rpc_error(-8, "not found", miner.updateprotxregistrar,
335335
"%064x" % getrandbits(256), "", "", "")
336336
self.log.info("Trying to update an operator address to an already used one...")
337-
assert_raises_rpc_error(RPC_VERIFY_REJECTED, "bad-protx-dup-key", controller.updateprotxregistrar,
337+
assert_raises_rpc_error(RPC_VERIFY_REJECTED, "bad-protx-dup-key", controller.update_protx_registrar,
338338
mns[0].proTx, mns[1].operator_pk, "", "")
339339
self.log.info("Trying to update the payee to an invalid address...")
340-
assert_raises_rpc_error(-5, "invalid PIVX address InvalidPayee", controller.updateprotxregistrar,
340+
assert_raises_rpc_error(-5, "invalid PIVX address InvalidPayee", controller.update_protx_registrar,
341341
mns[0].proTx, "", "", "InvalidPayee")
342342
self.log.info("Update operator keys...")
343343
bls_keypair = self.nodes[mns[0].idx].generateblskeypair()
344344
mns[0].operator_pk = bls_keypair["public"]
345345
mns[0].operator_sk = bls_keypair["secret"]
346346
# Controller should already have the key (as it was generated there), no need to pass it
347-
controller.updateprotxregistrar(mns[0].proTx, mns[0].operator_pk, "", "")
347+
controller.update_protx_registrar(mns[0].proTx, mns[0].operator_pk, "", "")
348348
self.sync_mempools([miner, controller])
349349
miner.generate(1)
350350
self.sync_blocks()
@@ -398,7 +398,7 @@ def run_test(self):
398398
assert_raises_rpc_error(-8, "not found", miner.revokeprotx,
399399
"%064x" % getrandbits(256))
400400
self.log.info("Trying to revoke with invalid reason...")
401-
assert_raises_rpc_error(-8, "invalid reason", controller.revokeprotx, mns[3].proTx, mns[3].operator_sk, 100)
401+
assert_raises_rpc_error(-8, "invalid reason", controller.revoke_protx, mns[3].proTx, mns[3].operator_sk, 100)
402402
self.log.info("Revoke masternode...")
403403
# Do it from the remote node (so no need to pass the operator BLS secret key)
404404
remote_node = self.nodes[mns[3].idx]
@@ -407,7 +407,7 @@ def run_test(self):
407407
miner.generate(1)
408408
self.sync_blocks()
409409
# Then send the ProUpRev tx from the masternode
410-
remote_node.revokeprotx(mns[3].proTx, "", 1)
410+
remote_node.revoke_protx(mns[3].proTx, "", 1)
411411
mns[3].revoked()
412412
self.sync_mempools([miner, remote_node])
413413
miner.generate(1)

0 commit comments

Comments
 (0)