Skip to content

Commit

Permalink
[RPC] Remove deprecated masternode/budget RPC commands
Browse files Browse the repository at this point in the history
The old `masternode` and `mnbudget` commands have been deprecated for
quite some time now, and have had a note in their help descriptions
stating as much. So, time to finally remove them for good.
  • Loading branch information
Fuzzbawls committed Apr 26, 2019
1 parent cfa3092 commit b079abf
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 253 deletions.
103 changes: 0 additions & 103 deletions src/rpc/budget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,109 +49,6 @@ void budgetToJSON(CBudgetProposal* pbudgetProposal, UniValue& bObj)
bObj.push_back(Pair("fValid", pbudgetProposal->fValid));
}

// This command is retained for backwards compatibility, but is depreciated.
// Future removal of this command is planned to keep things clean.
UniValue mnbudget(const UniValue& params, bool fHelp)
{
string strCommand;
if (params.size() >= 1)
strCommand = params[0].get_str();

if (fHelp ||
(strCommand != "vote-alias" && strCommand != "vote-many" && strCommand != "prepare" && strCommand != "submit" && strCommand != "vote" && strCommand != "getvotes" && strCommand != "getinfo" && strCommand != "show" && strCommand != "projection" && strCommand != "check" && strCommand != "nextblock"))
throw runtime_error(
"mnbudget \"command\"... ( \"passphrase\" )\n"
"\nVote or show current budgets\n"
"This command is depreciated, please see individual command documentation for future reference\n\n"

"\nAvailable commands:\n"
" prepare - Prepare proposal for network by signing and creating tx\n"
" submit - Submit proposal for network\n"
" vote-many - Vote on a PIVX initiative\n"
" vote-alias - Vote on a PIVX initiative\n"
" vote - Vote on a PIVX initiative/budget\n"
" getvotes - Show current masternode budgets\n"
" getinfo - Show current masternode budgets\n"
" show - Show all budgets\n"
" projection - Show the projection of which proposals will be paid the next cycle\n"
" check - Scan proposals and remove invalid\n"
" nextblock - Get next superblock for budget system\n");

if (strCommand == "nextblock") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return getnextsuperblock(newParams, fHelp);
}

if (strCommand == "prepare") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return preparebudget(newParams, fHelp);
}

if (strCommand == "submit") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return submitbudget(newParams, fHelp);
}

if (strCommand == "vote" || strCommand == "vote-many" || strCommand == "vote-alias") {
if (strCommand == "vote-alias")
throw runtime_error(
"vote-alias is not supported with this command\n"
"Please use mnbudgetvote instead.\n"
);
return mnbudgetvote(params, fHelp);
}

if (strCommand == "projection") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return getbudgetprojection(newParams, fHelp);
}

if (strCommand == "show" || strCommand == "getinfo") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return getbudgetinfo(newParams, fHelp);
}

if (strCommand == "getvotes") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return getbudgetvotes(newParams, fHelp);
}

if (strCommand == "check") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return checkbudgets(newParams, fHelp);
}

return NullUniValue;
}

UniValue preparebudget(const UniValue& params, bool fHelp)
{
int nBlockMin = 0;
Expand Down
4 changes: 0 additions & 4 deletions src/rpc/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ static const CRPCConvertParam vRPCConvertParams[] =
{"setban", 2},
{"setban", 3},
{"spork", 1},
{"mnbudget", 3},
{"mnbudget", 4},
{"mnbudget", 6},
{"mnbudget", 8},
{"preparebudget", 2},
{"preparebudget", 3},
{"preparebudget", 5},
Expand Down
141 changes: 0 additions & 141 deletions src/rpc/masternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,147 +45,6 @@ UniValue getpoolinfo(const UniValue& params, bool fHelp)
return obj;
}

// This command is retained for backwards compatibility, but is depreciated.
// Future removal of this command is planned to keep things clean.
UniValue masternode(const UniValue& params, bool fHelp)
{
string strCommand;
if (params.size() >= 1)
strCommand = params[0].get_str();

if (fHelp ||
(strCommand != "start" && strCommand != "start-alias" && strCommand != "start-many" && strCommand != "start-all" && strCommand != "start-missing" &&
strCommand != "start-disabled" && strCommand != "list" && strCommand != "list-conf" && strCommand != "count" && strCommand != "enforce" &&
strCommand != "debug" && strCommand != "current" && strCommand != "winners" && strCommand != "genkey" && strCommand != "connect" &&
strCommand != "outputs" && strCommand != "status" && strCommand != "calcscore"))
throw runtime_error(
"masternode \"command\"...\n"
"\nSet of commands to execute masternode related actions\n"
"This command is depreciated, please see individual command documentation for future reference\n\n"

"\nArguments:\n"
"1. \"command\" (string or set of strings, required) The command to execute\n"

"\nAvailable commands:\n"
" count - Print count information of all known masternodes\n"
" current - Print info on current masternode winner\n"
" debug - Print masternode status\n"
" genkey - Generate new masternodeprivkey\n"
" outputs - Print masternode compatible outputs\n"
" start - Start masternode configured in pivx.conf\n"
" start-alias - Start single masternode by assigned alias configured in masternode.conf\n"
" start-<mode> - Start masternodes configured in masternode.conf (<mode>: 'all', 'missing', 'disabled')\n"
" status - Print masternode status information\n"
" list - Print list of all known masternodes (see masternodelist for more info)\n"
" list-conf - Print masternode.conf in JSON format\n"
" winners - Print list of masternode winners\n");

if (strCommand == "list") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return listmasternodes(newParams, fHelp);
}

if (strCommand == "connect") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return masternodeconnect(newParams, fHelp);
}

if (strCommand == "count") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return getmasternodecount(newParams, fHelp);
}

if (strCommand == "current") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return masternodecurrent(newParams, fHelp);
}

if (strCommand == "debug") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return masternodedebug(newParams, fHelp);
}

if (strCommand == "start" || strCommand == "start-alias" || strCommand == "start-many" || strCommand == "start-all" || strCommand == "start-missing" || strCommand == "start-disabled") {
return startmasternode(params, fHelp);
}

if (strCommand == "genkey") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return createmasternodekey(newParams, fHelp);
}

if (strCommand == "list-conf") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return listmasternodeconf(newParams, fHelp);
}

if (strCommand == "outputs") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return getmasternodeoutputs(newParams, fHelp);
}

if (strCommand == "status") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return getmasternodestatus(newParams, fHelp);
}

if (strCommand == "winners") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return getmasternodewinners(newParams, fHelp);
}

if (strCommand == "calcscore") {
UniValue newParams(UniValue::VARR);
// forward params but skip command
for (unsigned int i = 1; i < params.size(); i++) {
newParams.push_back(params[i]);
}
return getmasternodescores(newParams, fHelp);
}

return NullUniValue;
}

UniValue listmasternodes(const UniValue& params, bool fHelp)
{
std::string strFilter = "";
Expand Down
2 changes: 0 additions & 2 deletions src/rpc/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ static const CRPCCommand vRPCCommands[] =
{ "hidden", "waitforblockheight", &waitforblockheight, true, true, false },

/* PIVX features */
{"pivx", "masternode", &masternode, true, true, false},
{"pivx", "listmasternodes", &listmasternodes, true, true, false},
{"pivx", "getmasternodecount", &getmasternodecount, true, true, false},
{"pivx", "masternodeconnect", &masternodeconnect, true, true, false},
Expand All @@ -381,7 +380,6 @@ static const CRPCCommand vRPCCommands[] =
{"pivx", "getmasternodestatus", &getmasternodestatus, true, true, false},
{"pivx", "getmasternodewinners", &getmasternodewinners, true, true, false},
{"pivx", "getmasternodescores", &getmasternodescores, true, true, false},
{"pivx", "mnbudget", &mnbudget, true, true, false},
{"pivx", "preparebudget", &preparebudget, true, true, false},
{"pivx", "submitbudget", &submitbudget, true, true, false},
{"pivx", "mnbudgetvote", &mnbudgetvote, true, true, false},
Expand Down
4 changes: 1 addition & 3 deletions src/rpc/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ extern UniValue getserials(const UniValue& params, bool fHelp);
extern UniValue getchecksumblock(const UniValue& params, bool fHelp);

extern UniValue getpoolinfo(const UniValue& params, bool fHelp); // in rpc/masternode.cpp
extern UniValue masternode(const UniValue& params, bool fHelp);
extern UniValue listmasternodes(const UniValue& params, bool fHelp);
extern UniValue getmasternodecount(const UniValue& params, bool fHelp);
extern UniValue createmasternodebroadcast(const UniValue& params, bool fHelp);
Expand All @@ -329,8 +328,7 @@ extern UniValue getmasternodestatus(const UniValue& params, bool fHelp);
extern UniValue getmasternodewinners(const UniValue& params, bool fHelp);
extern UniValue getmasternodescores(const UniValue& params, bool fHelp);

extern UniValue mnbudget(const UniValue& params, bool fHelp); // in rpc/budget.cpp
extern UniValue preparebudget(const UniValue& params, bool fHelp);
extern UniValue preparebudget(const UniValue& params, bool fHelp); // in rpc/budget.cpp
extern UniValue submitbudget(const UniValue& params, bool fHelp);
extern UniValue mnbudgetvote(const UniValue& params, bool fHelp);
extern UniValue getbudgetvotes(const UniValue& params, bool fHelp);
Expand Down

0 comments on commit b079abf

Please sign in to comment.