aboutsummaryrefslogtreecommitdiff
path: root/src/rpcwallet.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-06-16 14:45:32 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-07-11 15:24:29 +0200
commit6c37f7fd78832442a26e56bd0787974927df4fb2 (patch)
tree9c4138c7e53bbd4607a13de9169dd2d0dabee6be /src/rpcwallet.cpp
parent6ad2c2402e694d0052f8f1688181a80fe3eef2e7 (diff)
downloadbitcoin-6c37f7fd78832442a26e56bd0787974927df4fb2.tar.xz
`getrawchangeaddress` should fail when keypool exhausted
An user on IRC reported an issue where `getrawchangeaddress` keeps returning a single address when the keypool is exhausted. In my opinion this is strange behaviour. - Change CReserveKey to fail when running out of keys in the keypool. - Make `getrawchangeaddress` return RPC_WALLET_KEYPOOL_RAN_OUT when unable to create an address. - Add a Python RPC test for checking the keypool behaviour in combination with encrypted wallets.
Diffstat (limited to 'src/rpcwallet.cpp')
-rw-r--r--src/rpcwallet.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp
index 1e46129065..e8c62fd37b 100644
--- a/src/rpcwallet.cpp
+++ b/src/rpcwallet.cpp
@@ -201,7 +201,7 @@ Value getrawchangeaddress(const Array& params, bool fHelp)
CReserveKey reservekey(pwalletMain);
CPubKey vchPubKey;
if (!reservekey.GetReservedKey(vchPubKey))
- throw JSONRPCError(RPC_WALLET_ERROR, "Error: Unable to obtain key for change");
+ throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, "Error: Keypool ran out, please call keypoolrefill first");
reservekey.KeepKey();