@@ -819,28 +819,32 @@ UniValue protx_diff(const JSONRPCRequest& request)
819819 return ret;
820820}
821821
822+ [[ noreturn ]] void protx_help ()
823+ {
824+ throw std::runtime_error (
825+ " protx \" command\" ...\n "
826+ " Set of commands to execute ProTx related actions.\n "
827+ " To get help on individual commands, use \" help protx command\" .\n "
828+ " \n Arguments:\n "
829+ " 1. \" command\" (string, required) The command to execute\n "
830+ " \n Available commands:\n "
831+ " register - Create and send ProTx to network\n "
832+ " register_fund - Fund, create and send ProTx to network\n "
833+ " register_prepare - Create an unsigned ProTx\n "
834+ " register_submit - Sign and submit a ProTx\n "
835+ " list - List ProTxs\n "
836+ " info - Return information about a ProTx\n "
837+ " update_service - Create and send ProUpServTx to network\n "
838+ " update_registrar - Create and send ProUpRegTx to network\n "
839+ " revoke - Create and send ProUpRevTx to network\n "
840+ " diff - Calculate a diff and a proof between two masternode lists\n "
841+ );
842+ }
822843
823844UniValue protx (const JSONRPCRequest& request)
824845{
825- if (request.params .empty ()) {
826- throw std::runtime_error (
827- " protx \" command\" ...\n "
828- " Set of commands to execute ProTx related actions.\n "
829- " To get help on individual commands, use \" help protx command\" .\n "
830- " \n Arguments:\n "
831- " 1. \" command\" (string, required) The command to execute\n "
832- " \n Available commands:\n "
833- " register - Create and send ProTx to network\n "
834- " register_fund - Fund, create and send ProTx to network\n "
835- " register_prepare - Create an unsigned ProTx\n "
836- " register_submit - Sign and submit a ProTx\n "
837- " list - List ProTxs\n "
838- " info - Return information about a ProTx\n "
839- " update_service - Create and send ProUpServTx to network\n "
840- " update_registrar - Create and send ProUpRegTx to network\n "
841- " revoke - Create and send ProUpRevTx to network\n "
842- " diff - Calculate a diff and a proof between two masternode lists\n "
843- );
846+ if (request.fHelp || request.params .empty ()) {
847+ protx_help ();
844848 }
845849
846850 std::string command = request.params [0 ].get_str ();
@@ -862,7 +866,7 @@ UniValue protx(const JSONRPCRequest& request)
862866 } else if (command == " diff" ) {
863867 return protx_diff (request);
864868 } else {
865- throw std::runtime_error ( " invalid command: " + command );
869+ protx_help ( );
866870 }
867871}
868872#endif // ENABLE_WALLET
@@ -897,7 +901,7 @@ UniValue bls_generate(const JSONRPCRequest& request)
897901 return ret;
898902}
899903
900- void bls_help ()
904+ [[ noreturn ]] void bls_help ()
901905{
902906 throw std::runtime_error (
903907 " bls \" command\" ...\n "
@@ -912,7 +916,7 @@ void bls_help()
912916
913917UniValue _bls (const JSONRPCRequest& request)
914918{
915- if (request.params .empty ()) {
919+ if (request.fHelp || request. params .empty ()) {
916920 bls_help ();
917921 }
918922
0 commit comments