std::string HelpRequiringPassphrase()
{
return pwalletMain->IsCrypted()
- ? "\nrequires wallet passphrase to be set with walletpassphrase first"
+ ? "\n\nRequires wallet passphrase to be set with walletpassphrase first"
: "";
}
if (fHelp || params.size() > 1)
throw runtime_error(
"keypoolrefill [new-size]\n"
- "Fills the keypool."
+ "Fills the keypool.\n"
+ "IMPORTANT: Any previous backups you have made of your wallet file "
+ "should be replaced with the newly generated one."
+ HelpRequiringPassphrase());
unsigned int nSize = max<unsigned int>(GetArg("-keypool", 100), 0);
return Value::null;
}
+Value keypoolreset(const Array& params, bool fHelp)
+{
+ if (fHelp || params.size() > 1)
+ throw runtime_error(
+ "keypoolreset [new-size]\n"
+ "Resets the keypool.\n"
+ "IMPORTANT: Any previous backups you have made of your wallet file "
+ "should be replaced with the newly generated one."
+ + HelpRequiringPassphrase());
+
+ unsigned int nSize = max<unsigned int>(GetArg("-keypool", 100), 0);
+ if (params.size() > 0) {
+ if (params[0].get_int() < 0)
+ throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected valid size");
+ nSize = (unsigned int) params[0].get_int();
+ }
+
+ EnsureWalletIsUnlocked();
+
+ pwalletMain->NewKeyPool(nSize);
+
+ if (pwalletMain->GetKeyPoolSize() < nSize)
+ throw JSONRPCError(RPC_WALLET_ERROR, "Error refreshing keypool.");
+
+ return Value::null;
+}
+
void ThreadTopUpKeyPool(void* parg)
{