Skip to content

Commit 00f58f8

Browse files
committed
rpc: Avoid locking cs_main in some wallet RPC
1 parent 1b04b55 commit 00f58f8

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,6 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
562562
+ HelpExampleRpc("decoderawtransaction", "\"hexstring\"")
563563
);
564564

565-
LOCK(cs_main);
566565
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL});
567566

568567
CMutableTransaction mtx;

src/wallet/rpcwallet.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static UniValue getnewaddress(const JSONRPCRequest& request)
165165
throw JSONRPCError(RPC_WALLET_ERROR, "Error: Private keys are disabled for this wallet");
166166
}
167167

168-
LOCK2(cs_main, pwallet->cs_wallet);
168+
LOCK(pwallet->cs_wallet);
169169

170170
// Parse the label first so we don't generate a key if there's an error
171171
std::string label;
@@ -276,7 +276,7 @@ static UniValue getrawchangeaddress(const JSONRPCRequest& request)
276276
throw JSONRPCError(RPC_WALLET_ERROR, "Error: Private keys are disabled for this wallet");
277277
}
278278

279-
LOCK2(cs_main, pwallet->cs_wallet);
279+
LOCK(pwallet->cs_wallet);
280280

281281
if (!pwallet->IsLocked()) {
282282
pwallet->TopUpKeyPool();
@@ -331,7 +331,7 @@ static UniValue setlabel(const JSONRPCRequest& request)
331331
+ HelpExampleRpc("setlabel", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", \"tabby\"")
332332
);
333333

334-
LOCK2(cs_main, pwallet->cs_wallet);
334+
LOCK(pwallet->cs_wallet);
335335

336336
CTxDestination dest = DecodeDestination(request.params[0].get_str());
337337
if (!IsValidDestination(dest)) {

0 commit comments

Comments
 (0)