Merge #12727: [RPC] Remove unreachable help conditions in rpcwallet.cpp

e5468a19d1 Remove unreachable help conditions (lutangar)

Pull request description:

  These conditions on `request.fHelp`, which appears in the body of the following functions are never reached:
  * `walletpassphrase`
  * `walletpassphrasechange`
  * `encryptwallet`
  ```
  ...
      if (request.fHelp || request.params.size() != 0) {
          throw std::runtime_error("");
      }
  ...
      if (request.fHelp)
          return true;
  ...
  ```
  The first condition would throw if `request.fHelp` evaluates to `true`.

Tree-SHA512: 1aa41ed233c6bebae27151ab5cc67144d2a408335a3acef3c103e144d6343685f360b1146e14bc8dc1d53d00fcfc6ff1ab6a0eeb0805191172a23b306ab50b79
pull/12731/head
MarcoFalke 7 years ago
commit 8ee5c7b747
No known key found for this signature in database
GPG Key ID: D2EA4850E7528B25

@ -2363,8 +2363,6 @@ UniValue walletpassphrase(const JSONRPCRequest& request)
LOCK2(cs_main, pwallet->cs_wallet);
if (request.fHelp)
return true;
if (!pwallet->IsCrypted()) {
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletpassphrase was called.");
}
@ -2429,8 +2427,6 @@ UniValue walletpassphrasechange(const JSONRPCRequest& request)
LOCK2(cs_main, pwallet->cs_wallet);
if (request.fHelp)
return true;
if (!pwallet->IsCrypted()) {
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletpassphrasechange was called.");
}
@ -2485,8 +2481,6 @@ UniValue walletlock(const JSONRPCRequest& request)
LOCK2(cs_main, pwallet->cs_wallet);
if (request.fHelp)
return true;
if (!pwallet->IsCrypted()) {
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletlock was called.");
}
@ -2532,8 +2526,6 @@ UniValue encryptwallet(const JSONRPCRequest& request)
LOCK2(cs_main, pwallet->cs_wallet);
if (request.fHelp)
return true;
if (pwallet->IsCrypted()) {
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an encrypted wallet, but encryptwallet was called.");
}

Loading…
Cancel
Save