Skip to content

Commit

Permalink
rpc: Avoid locking cs_main in some wallet RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
promag committed Aug 23, 2018
1 parent 1b04b55 commit 00f58f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
+ HelpExampleRpc("decoderawtransaction", "\"hexstring\"")
);

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

CMutableTransaction mtx;
Expand Down
6 changes: 3 additions & 3 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static UniValue getnewaddress(const JSONRPCRequest& request)
throw JSONRPCError(RPC_WALLET_ERROR, "Error: Private keys are disabled for this wallet");
}

LOCK2(cs_main, pwallet->cs_wallet);
LOCK(pwallet->cs_wallet);

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

LOCK2(cs_main, pwallet->cs_wallet);
LOCK(pwallet->cs_wallet);

if (!pwallet->IsLocked()) {
pwallet->TopUpKeyPool();
Expand Down Expand Up @@ -331,7 +331,7 @@ static UniValue setlabel(const JSONRPCRequest& request)
+ HelpExampleRpc("setlabel", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", \"tabby\"")
);

LOCK2(cs_main, pwallet->cs_wallet);
LOCK(pwallet->cs_wallet);

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

0 comments on commit 00f58f8

Please sign in to comment.