mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Merge pull request #67 from UdjinM6/110x_fix_walletpassphrase
fix walletpassphrase logic/params/description
This commit is contained in:
commit
6277435350
@ -150,6 +150,7 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri
|
||||
if (strMethod == "listtransactions" && n > 2) ConvertTo<int64_t>(params[2]);
|
||||
if (strMethod == "listaccounts" && n > 0) ConvertTo<int64_t>(params[0]);
|
||||
if (strMethod == "walletpassphrase" && n > 1) ConvertTo<int64_t>(params[1]);
|
||||
if (strMethod == "walletpassphrase" && n > 2) ConvertTo<bool>(params[2]);
|
||||
if (strMethod == "getblocktemplate" && n > 0) ConvertTo<Object>(params[0]);
|
||||
if (strMethod == "listsinceblock" && n > 1) ConvertTo<int64_t>(params[1]);
|
||||
if (strMethod == "sendmany" && n > 1) ConvertTo<Object>(params[1]);
|
||||
|
@ -1563,23 +1563,25 @@ Value walletpassphrase(const Array& params, bool fHelp)
|
||||
{
|
||||
if (pwalletMain->IsCrypted() && (fHelp || params.size() < 2 || params.size() > 3))
|
||||
throw runtime_error(
|
||||
"walletpassphrase \"passphrase\" <timeout> <anonymizeOnly>\n"
|
||||
"walletpassphrase \"passphrase\" timeout ( anonymizeonly )>\n"
|
||||
"\nStores the wallet decryption key in memory for 'timeout' seconds.\n"
|
||||
"This is needed prior to performing transactions related to private keys such as sending darkcoins\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"passphrase\" (string, required) The wallet passphrase\n"
|
||||
"2. timeout (numeric, required) The time to keep the decryption key in seconds.\n"
|
||||
"3. anonymizeonly (boolean, optional, default=flase) If is true sending functions are disabled."
|
||||
"\nNote:\n"
|
||||
"Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock\n"
|
||||
"time that overrides the old one.\n"
|
||||
"\nExamples:\n"
|
||||
"\nunlock the wallet for 60 seconds\n"
|
||||
"\nUlock the wallet for 60 seconds\n"
|
||||
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 60") +
|
||||
"\nUlock the wallet for 60 seconds but allow Darksend mixing only\n"
|
||||
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 60 true") +
|
||||
"\nLock the wallet again (before 60 seconds)\n"
|
||||
+ HelpExampleCli("walletlock", "") +
|
||||
"\nAs json rpc call\n"
|
||||
+ HelpExampleRpc("walletpassphrase", "\"my pass phrase\", 60") +
|
||||
"if [anonymizeonly] is true sending functions are disabled."
|
||||
+ HelpExampleRpc("walletpassphrase", "\"my pass phrase\", 60")
|
||||
);
|
||||
|
||||
if (fHelp)
|
||||
@ -1594,24 +1596,15 @@ Value walletpassphrase(const Array& params, bool fHelp)
|
||||
// Alternately, find a way to make params[0] mlock()'d to begin with.
|
||||
strWalletPass = params[0].get_str().c_str();
|
||||
|
||||
if (strWalletPass.length() > 0)
|
||||
{
|
||||
bool anonymizeOnly;
|
||||
if (params.size() == 3)
|
||||
anonymizeOnly = params[2].get_bool();
|
||||
else
|
||||
anonymizeOnly = false;
|
||||
bool anonymizeOnly = false;
|
||||
if (params.size() == 3)
|
||||
anonymizeOnly = params[2].get_bool();
|
||||
|
||||
if (!pwalletMain->IsLocked() && pwalletMain->fWalletUnlockAnonymizeOnly && anonymizeOnly)
|
||||
throw JSONRPCError(RPC_WALLET_ALREADY_UNLOCKED, "Error: Wallet is already unlocked.");
|
||||
if (!pwalletMain->IsLocked() && pwalletMain->fWalletUnlockAnonymizeOnly && anonymizeOnly)
|
||||
throw JSONRPCError(RPC_WALLET_ALREADY_UNLOCKED, "Error: Wallet is already unlocked.");
|
||||
|
||||
if (!pwalletMain->Unlock(strWalletPass, anonymizeOnly))
|
||||
throw JSONRPCError(RPC_WALLET_PASSPHRASE_INCORRECT, "Error: The wallet passphrase entered was incorrect.");
|
||||
}
|
||||
else
|
||||
throw runtime_error(
|
||||
"walletpassphrase <passphrase> <timeout> <anonymizeOnly>\n"
|
||||
"Stores the wallet decryption key in memory for <timeout> seconds.");
|
||||
if (!pwalletMain->Unlock(strWalletPass, anonymizeOnly))
|
||||
throw JSONRPCError(RPC_WALLET_PASSPHRASE_INCORRECT, "Error: The wallet passphrase entered was incorrect.");
|
||||
|
||||
pwalletMain->TopUpKeyPool();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user