diff options
| author | Wladimir J. van der Laan <[email protected]> | 2013-12-09 16:24:08 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2013-12-09 16:24:23 +0100 |
| commit | 20a3c807907643123298405632628b1629ff61a1 (patch) | |
| tree | 77389c0125df579e321e64d0e4bf5e8150fdded2 /src | |
| parent | Merge pull request #3297 (diff) | |
| parent | rpcwallet: use EnsureWalletIsUnlocked() where possible (diff) | |
| download | discoin-20a3c807907643123298405632628b1629ff61a1.tar.xz discoin-20a3c807907643123298405632628b1629ff61a1.zip | |
Merge pull request #3178
f914c7a rpcwallet: use EnsureWalletIsUnlocked() where possible (Philip Kaufmann)
Diffstat (limited to 'src')
| -rw-r--r-- | src/rpcwallet.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index bb87afec5..82fa9d88c 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -334,8 +334,7 @@ Value sendtoaddress(const Array& params, bool fHelp) if (params.size() > 3 && params[3].type() != null_type && !params[3].get_str().empty()) wtx.mapValue["to"] = params[3].get_str(); - if (pwalletMain->IsLocked()) - throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first."); + EnsureWalletIsUnlocked(); string strError = pwalletMain->SendMoneyToDestination(address.Get(), nAmount, wtx); if (strError != "") @@ -1657,15 +1656,15 @@ Value keypoolrefill(const Array& params, bool fHelp) + HelpExampleRpc("keypoolrefill", "") ); - unsigned int kpSize = max(GetArg("-keypool", 100), (int64_t) 0); + // 0 is interpreted by TopUpKeyPool() as the default keypool size given by -keypool + unsigned int kpSize = 0; if (params.size() > 0) { if (params[0].get_int() < 0) - throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected valid size"); - kpSize = (unsigned int) params[0].get_int(); + throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected valid size."); + kpSize = (unsigned int)params[0].get_int(); } EnsureWalletIsUnlocked(); - pwalletMain->TopUpKeyPool(kpSize); if (pwalletMain->GetKeyPoolSize() < kpSize) |