}
}
+Value getnewpubkey(const Array& params, bool fHelp)
+{
+ if (fHelp || params.size() > 1)
+ throw runtime_error(
+ "getnewpubkey [account]\n"
+ "Returns new public key for coinbase generation.");
+
+ // Parse the account first so we don't generate a key if there's an error
+ string strAccount;
+ if (params.size() > 0)
+ strAccount = AccountFromValue(params[0]);
+
+ if (!pwalletMain->IsLocked())
+ pwalletMain->TopUpKeyPool();
+
+ // Generate a new key that is added to wallet
+ std::vector<unsigned char> newKey = pwalletMain->GenerateNewKey(false);
+
+ if(!newKey.size())
+ throw JSONRPCError(-12, "Error: Unable to create key");
+
+ CBitcoinAddress address(newKey);
+ pwalletMain->SetAddressBookName(address, strAccount);
+
+ return HexStr(newKey.begin(), newKey.end());
+}
+
+
Value getblockhash(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
{ "getinfo", &getinfo, true },
{ "getmininginfo", &getmininginfo, true },
{ "getnewaddress", &getnewaddress, true },
+ { "getnewpubkey", &getnewpubkey, true },
{ "getaccountaddress", &getaccountaddress, true },
{ "setaccount", &setaccount, true },
{ "getaccount", &getaccount, false },
// keystore implementation
// Generate a new key
- std::vector<unsigned char> GenerateNewKey();
+ std::vector<unsigned char> GenerateNewKey(bool bCompressed);
// Adds a key to the store, and saves it to disk.
bool AddKey(const CKey& key);
// Adds a key to the store, without saving it to disk (used by LoadWallet)