Skip to content

Commit 8ee5c7b

Browse files
author
MarcoFalke
committed
Merge #12727: [RPC] Remove unreachable help conditions in rpcwallet.cpp
e5468a1 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
2 parents ee7b67e + e5468a1 commit 8ee5c7b

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2363,8 +2363,6 @@ UniValue walletpassphrase(const JSONRPCRequest& request)
23632363

23642364
LOCK2(cs_main, pwallet->cs_wallet);
23652365

2366-
if (request.fHelp)
2367-
return true;
23682366
if (!pwallet->IsCrypted()) {
23692367
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletpassphrase was called.");
23702368
}
@@ -2429,8 +2427,6 @@ UniValue walletpassphrasechange(const JSONRPCRequest& request)
24292427

24302428
LOCK2(cs_main, pwallet->cs_wallet);
24312429

2432-
if (request.fHelp)
2433-
return true;
24342430
if (!pwallet->IsCrypted()) {
24352431
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletpassphrasechange was called.");
24362432
}
@@ -2485,8 +2481,6 @@ UniValue walletlock(const JSONRPCRequest& request)
24852481

24862482
LOCK2(cs_main, pwallet->cs_wallet);
24872483

2488-
if (request.fHelp)
2489-
return true;
24902484
if (!pwallet->IsCrypted()) {
24912485
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletlock was called.");
24922486
}
@@ -2532,8 +2526,6 @@ UniValue encryptwallet(const JSONRPCRequest& request)
25322526

25332527
LOCK2(cs_main, pwallet->cs_wallet);
25342528

2535-
if (request.fHelp)
2536-
return true;
25372529
if (pwallet->IsCrypted()) {
25382530
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an encrypted wallet, but encryptwallet was called.");
25392531
}

0 commit comments

Comments
 (0)