aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-07-11 15:34:21 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-07-11 15:34:27 +0200
commitd3165ed35adde59bdfbe72928b51a039202fa21e (patch)
tree9c4138c7e53bbd4607a13de9169dd2d0dabee6be /src
parent6ad2c2402e694d0052f8f1688181a80fe3eef2e7 (diff)
parent6c37f7fd78832442a26e56bd0787974927df4fb2 (diff)
downloadbitcoin-d3165ed35adde59bdfbe72928b51a039202fa21e.tar.xz
Merge pull request #4347
6c37f7f `getrawchangeaddress` should fail when keypool exhausted (Wladimir J. van der Laan)
Diffstat (limited to 'src')
-rw-r--r--src/miner.cpp3
-rw-r--r--src/rpcwallet.cpp2
-rw-r--r--src/wallet.cpp6
3 files changed, 5 insertions, 6 deletions
diff --git a/src/miner.cpp b/src/miner.cpp
index 17918a1280..ec56c71192 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -467,7 +467,10 @@ void static BitcoinMiner(CWallet *pwallet)
auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey));
if (!pblocktemplate.get())
+ {
+ LogPrintf("Error in BitcoinMiner: Keypool ran out, please call keypoolrefill before restarting the mining thread\n");
return;
+ }
CBlock *pblock = &pblocktemplate->block;
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
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();
diff --git a/src/wallet.cpp b/src/wallet.cpp
index a54494f935..8fdc5f4b20 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -2010,11 +2010,7 @@ bool CReserveKey::GetReservedKey(CPubKey& pubkey)
if (nIndex != -1)
vchPubKey = keypool.vchPubKey;
else {
- if (pwallet->vchDefaultKey.IsValid()) {
- LogPrintf("CReserveKey::GetReservedKey(): Warning: Using default key instead of a new key, top up your keypool!");
- vchPubKey = pwallet->vchDefaultKey;
- } else
- return false;
+ return false;
}
}
assert(vchPubKey.IsValid());