Skip to content

Commit ae262f3

Browse files
committed
rpc: deprecate legacy variants of ProTx register, update_registrar
1 parent ee34525 commit ae262f3

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

doc/release-notes-6723.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Updated RPCs
2+
------------
3+
4+
* The RPCs `protx register_legacy`, `protx register_fund_legacy`, `protx register_prepare_legacy` and
5+
`protx update_registrar_legacy` have been deprecated in Dash Core v23 and may be removed in a future version
6+
They can be re-enabled with the runtime argument `-deprecatedrpc=legacy_mn`.

src/rpc/evo.cpp

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ static RPCHelpMan protx_register_fund_wrapper(const bool legacy)
379379
"masternode.\n"
380380
"A few of the limitations you see in the arguments are temporary and might be lifted after DIP3\n"
381381
"is fully deployed.\n"
382+
+ std::string(legacy ? "\nDEPRECATED: May be removed in a future version, pass config option -deprecatedrpc=legacy_mn to use RPC\n" : "")
382383
+ HELP_REQUIRING_PASSPHRASE,
383384
{
384385
GetRpcArg("collateralAddress"),
@@ -402,6 +403,9 @@ static RPCHelpMan protx_register_fund_wrapper(const bool legacy)
402403
},
403404
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
404405
{
406+
if (legacy && !IsDeprecatedRPCEnabled("legacy_mn")) {
407+
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to enable this RPC");
408+
}
405409
return protx_register_common_wrapper(request, self.m_name == "protx register_fund_legacy", ProTxRegisterAction::Fund, MnType::Regular);
406410
},
407411
};
@@ -425,6 +429,7 @@ static RPCHelpMan protx_register_wrapper(bool legacy)
425429
"\nSame as \"protx register_fund\", but with an externally referenced collateral.\n"
426430
"The collateral is specified through \"collateralHash\" and \"collateralIndex\" and must be an unspent\n"
427431
"transaction output spendable by this wallet. It must also not be used by any other masternode.\n"
432+
+ std::string(legacy ? "\nDEPRECATED: May be removed in a future version, pass config option -deprecatedrpc=legacy_mn to use RPC\n" : "")
428433
+ HELP_REQUIRING_PASSPHRASE,
429434
{
430435
GetRpcArg("collateralHash"),
@@ -449,6 +454,9 @@ static RPCHelpMan protx_register_wrapper(bool legacy)
449454
},
450455
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
451456
{
457+
if (legacy && !IsDeprecatedRPCEnabled("legacy_mn")) {
458+
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to enable this RPC");
459+
}
452460
return protx_register_common_wrapper(request, self.m_name == "protx register_legacy", ProTxRegisterAction::External, MnType::Regular);
453461
},
454462
};
@@ -473,7 +481,8 @@ static RPCHelpMan protx_register_prepare_wrapper(const bool legacy)
473481
return RPCHelpMan{rpc_full_name,
474482
"\nCreates an unsigned ProTx and a message that must be signed externally\n"
475483
"with the private key that corresponds to collateralAddress to prove collateral ownership.\n"
476-
"The prepared transaction will also contain inputs and outputs to cover fees.\n",
484+
"The prepared transaction will also contain inputs and outputs to cover fees.\n"
485+
+ std::string(legacy ? "\nDEPRECATED: May be removed in a future version, pass config option -deprecatedrpc=legacy_mn to use RPC\n" : ""),
477486
{
478487
GetRpcArg("collateralHash"),
479488
GetRpcArg("collateralIndex"),
@@ -497,6 +506,9 @@ static RPCHelpMan protx_register_prepare_wrapper(const bool legacy)
497506
},
498507
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
499508
{
509+
if (legacy && !IsDeprecatedRPCEnabled("legacy_mn")) {
510+
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to enable this RPC");
511+
}
500512
return protx_register_common_wrapper(request, self.m_name == "protx register_prepare_legacy", ProTxRegisterAction::Prepare, MnType::Regular);
501513
},
502514
};
@@ -1063,6 +1075,7 @@ static RPCHelpMan protx_update_registrar_wrapper(const bool specific_legacy_bls_
10631075
"\nCreates and sends a ProUpRegTx to the network. This will update the operator key, voting key and payout\n"
10641076
"address of the masternode specified by \"proTxHash\".\n"
10651077
"The owner key of the masternode must be known to your wallet.\n"
1078+
+ std::string(specific_legacy_bls_scheme ? "\nDEPRECATED: May be removed in a future version, pass config option -deprecatedrpc=legacy_mn to use RPC\n" : "")
10661079
+ HELP_REQUIRING_PASSPHRASE,
10671080
{
10681081
GetRpcArg("proTxHash"),
@@ -1080,6 +1093,10 @@ static RPCHelpMan protx_update_registrar_wrapper(const bool specific_legacy_bls_
10801093
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
10811094
{
10821095
const bool use_legacy{self.m_name == "protx update_registrar_legacy"};
1096+
if (use_legacy && !IsDeprecatedRPCEnabled("legacy_mn")) {
1097+
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to enable this RPC");
1098+
}
1099+
10831100
const NodeContext& node = EnsureAnyNodeContext(request.context);
10841101
const ChainstateManager& chainman = EnsureChainman(node);
10851102

@@ -1662,9 +1679,9 @@ static RPCHelpMan protx_help()
16621679
" register_evo - Create and send ProTx to network for an EvoNode\n"
16631680
" register_fund_evo - Fund, create and send ProTx to network for an EvoNode\n"
16641681
" register_prepare_evo - Create an unsigned ProTx for an EvoNode\n"
1665-
" register_legacy - Create a ProTx by parsing BLS using the legacy scheme and send it to network\n"
1666-
" register_fund_legacy - Fund and create a ProTx by parsing BLS using the legacy scheme, then send it to network\n"
1667-
" register_prepare_legacy - Create an unsigned ProTx by parsing BLS using the legacy scheme\n"
1682+
" register_legacy - (DEPRECATED) Create a ProTx by parsing BLS using the legacy scheme and send it to network\n"
1683+
" register_fund_legacy - (DEPRECATED) Fund and create a ProTx by parsing BLS using the legacy scheme, then send it to network\n"
1684+
" register_prepare_legacy - (DEPRECATED) Create an unsigned ProTx by parsing BLS using the legacy scheme\n"
16681685
" register_submit - Sign and submit a ProTx\n"
16691686
#endif
16701687
" list - List ProTxs\n"
@@ -1673,7 +1690,7 @@ static RPCHelpMan protx_help()
16731690
" update_service - Create and send ProUpServTx to network\n"
16741691
" update_service_evo - Create and send ProUpServTx to network for an EvoNode\n"
16751692
" update_registrar - Create and send ProUpRegTx to network\n"
1676-
" update_registrar_legacy - Create ProUpRegTx by parsing BLS using the legacy scheme, then send it to network\n"
1693+
" update_registrar_legacy - (DEPRECATED) Create ProUpRegTx by parsing BLS using the legacy scheme, then send it to network\n"
16771694
" revoke - Create and send ProUpRevTx to network\n"
16781695
#endif
16791696
" diff - Calculate a diff and a proof between two masternode lists\n"
@@ -1788,19 +1805,19 @@ static const CRPCCommand commands[] =
17881805
{ "evo", &protx_info, },
17891806
{ "evo", &protx_register, },
17901807
{ "evo", &protx_register_evo, },
1791-
{ "evo", &protx_register_legacy, },
17921808
{ "evo", &protx_register_fund, },
1793-
{ "evo", &protx_register_fund_legacy, },
17941809
{ "evo", &protx_register_fund_evo, },
17951810
{ "evo", &protx_register_prepare, },
17961811
{ "evo", &protx_register_prepare_evo, },
1797-
{ "evo", &protx_register_prepare_legacy, },
17981812
{ "evo", &protx_update_service, },
17991813
{ "evo", &protx_update_service_evo, },
18001814
{ "evo", &protx_register_submit, },
18011815
{ "evo", &protx_update_registrar, },
1802-
{ "evo", &protx_update_registrar_legacy, },
18031816
{ "evo", &protx_revoke, },
1817+
{ "hidden", &protx_register_legacy, },
1818+
{ "hidden", &protx_register_fund_legacy, },
1819+
{ "hidden", &protx_register_prepare_legacy, },
1820+
{ "hidden", &protx_update_registrar_legacy, },
18041821
};
18051822
// clang-format on
18061823
return commands;

test/functional/feature_dip3_v19.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def getmnlistdiff(self, base_block_hash, block_hash):
4747
class DIP3V19Test(DashTestFramework):
4848
def set_test_params(self):
4949
self.extra_args = [[
50+
'-deprecatedrpc=legacy_mn',
5051
'-testactivationheight=v19@200',
5152
]] * 6
5253
self.set_dash_test_params(6, 5, evo_count=2, extra_args=self.extra_args)

0 commit comments

Comments
 (0)