add compressed option to masternode genkey (#2232)

* add compressed option to `masternode genkey`

* use ParseBoolV method

* adjust help message for masternode genkey
This commit is contained in:
Nathan Marley 2018-08-21 07:08:11 -07:00 committed by UdjinM6
parent 98ed90cbb4
commit 2997d6d268

View File

@ -145,7 +145,7 @@ UniValue masternode(const JSONRPCRequest& request)
" check - Force check all masternodes and remove invalid ones\n" " check - Force check all masternodes and remove invalid ones\n"
" count - Get information about number of masternodes (DEPRECATED options: 'total', 'ps', 'enabled', 'qualify', 'all')\n" " count - Get information about number of masternodes (DEPRECATED options: 'total', 'ps', 'enabled', 'qualify', 'all')\n"
" current - Print info on current masternode winner to be paid the next block (calculated locally)\n" " current - Print info on current masternode winner to be paid the next block (calculated locally)\n"
" genkey - Generate new masternodeprivkey\n" " genkey - Generate new masternodeprivkey, optional param: 'compressed' (boolean, optional, default=false) generate compressed privkey\n"
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
" outputs - Print masternode compatible outputs\n" " outputs - Print masternode compatible outputs\n"
" start-alias - Start single remote masternode by assigned alias configured in masternode.conf\n" " start-alias - Start single remote masternode by assigned alias configured in masternode.conf\n"
@ -375,8 +375,13 @@ UniValue masternode(const JSONRPCRequest& request)
if (strCommand == "genkey") if (strCommand == "genkey")
{ {
bool fCompressed = false;
if (request.params.size() > 1) {
fCompressed = ParseBoolV(request.params[1], "compressed");
}
CKey secret; CKey secret;
secret.MakeNewKey(false); secret.MakeNewKey(fCompressed);
return CBitcoinSecret(secret).ToString(); return CBitcoinSecret(secret).ToString();
} }