Browse Source

Fix bad merge: getaccountaddress was broken for new accounts

miguelfreitas
Gavin Andresen 13 years ago
parent
commit
2f4c30fd85
  1. 11
      src/rpc.cpp

11
src/rpc.cpp

@ -379,14 +379,11 @@ CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false)
// Generate a new key // Generate a new key
if (account.vchPubKey.empty() || bForceNew || bKeyUsed) if (account.vchPubKey.empty() || bForceNew || bKeyUsed)
{ {
if (pwalletMain->GetKeyPoolSize() < 1) if (!pwalletMain->GetKeyFromPool(account.vchPubKey, false))
{ throw JSONRPCError(-12, "Error: Keypool ran out, please call keypoolrefill first");
if (!pwalletMain->GetKeyFromPool(account.vchPubKey, false))
throw JSONRPCError(-12, "Error: Keypool ran out, please call keypoolrefill first");
pwalletMain->SetAddressBookName(CBitcoinAddress(account.vchPubKey), strAccount); pwalletMain->SetAddressBookName(CBitcoinAddress(account.vchPubKey), strAccount);
walletdb.WriteAccount(strAccount, account); walletdb.WriteAccount(strAccount, account);
}
} }
return CBitcoinAddress(account.vchPubKey); return CBitcoinAddress(account.vchPubKey);

Loading…
Cancel
Save