diff options
| author | Jeff Garzik <[email protected]> | 2013-06-25 16:21:42 -0400 |
|---|---|---|
| committer | Jeff Garzik <[email protected]> | 2013-06-25 16:21:42 -0400 |
| commit | 36bd46f1c4330fa57a3730bd80706eca11510b55 (patch) | |
| tree | 1b85ec3e3b0f3a064f6378484fbdaca34f2704a9 /src/rpcwallet.cpp | |
| parent | CWallet::TopUpKeyPool() takes optional pool size argument (diff) | |
| download | discoin-36bd46f1c4330fa57a3730bd80706eca11510b55.tar.xz discoin-36bd46f1c4330fa57a3730bd80706eca11510b55.zip | |
RPC: keypoolrefill gains optional size parameter
Diffstat (limited to 'src/rpcwallet.cpp')
| -rw-r--r-- | src/rpcwallet.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 7d3cfad76..f79fe7876 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -1253,17 +1253,24 @@ Value backupwallet(const Array& params, bool fHelp) Value keypoolrefill(const Array& params, bool fHelp) { - if (fHelp || params.size() > 0) + if (fHelp || params.size() > 1) throw runtime_error( - "keypoolrefill\n" + "keypoolrefill [new-size]\n" "Fills the keypool." + HelpRequiringPassphrase()); + unsigned int kpSize = max(GetArg("-keypool", 100), 0LL); + if (params.size() > 0) { + if (params[0].get_int() < 0) + throw JSONRPCError(-8, "Invalid parameter, expected valid size"); + kpSize = (unsigned int) params[0].get_int(); + } + EnsureWalletIsUnlocked(); - pwalletMain->TopUpKeyPool(); + pwalletMain->TopUpKeyPool(kpSize); - if (pwalletMain->GetKeyPoolSize() < GetArg("-keypool", 100)) + if (pwalletMain->GetKeyPoolSize() < kpSize) throw JSONRPCError(RPC_WALLET_ERROR, "Error refreshing keypool."); return Value::null; |