Merge #12559: Avoid locking cs_main in some wallet RPC

00f58f8c48db05dce9dceed73a0028482e037f0f rpc: Avoid locking cs_main in some wallet RPC (João Barbosa)

Pull request description:

  Avoid locking `cs_main` in the folllowing wallet RPC:
   - `decoderawtransaction`
   - `getnewaddress`
   - `getrawchangeaddress`
   - `setlabel`

Tree-SHA512: 54089766b2a969a17479af6c60e8ce151fac1f8cec268d43c61e679d5d17e76d17e414240c9ca2bfd280165f3a04e24a51310eb283591cd601a7eebc8b2423ea
This commit is contained in:
Wladimir J. van der Laan 2018-08-23 19:30:12 +02:00 committed by Munkybooty
parent 650cadb914
commit 99f1bea7f7
2 changed files with 3 additions and 4 deletions

View File

@ -601,7 +601,6 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
+ HelpExampleRpc("decoderawtransaction", "\"hexstring\"")
);
LOCK(cs_main);
RPCTypeCheck(request.params, {UniValue::VSTR});
CMutableTransaction mtx;

View File

@ -168,7 +168,7 @@ 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;
@ -269,7 +269,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(true)) {
pwallet->TopUpKeyPool();
@ -316,7 +316,7 @@ static UniValue setlabel(const JSONRPCRequest& request)
+ HelpExampleRpc("setlabel", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\", \"tabby\"")
);
LOCK2(cs_main, pwallet->cs_wallet);
LOCK(pwallet->cs_wallet);
CTxDestination dest = DecodeDestination(request.params[0].get_str());
if (!IsValidDestination(dest)) {