aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-08-23 19:30:12 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-08-23 19:38:18 +0200
commit540bf8aacc50aae0ea5beb76511905a7d2a3e15f (patch)
tree7198159cb532b28309847b7a4ef37dcbcd2ee9b1
parent5b52aa68584f6c5ea2f942db8f3a7c1feef2cf43 (diff)
parent00f58f8c48db05dce9dceed73a0028482e037f0f (diff)
downloadbitcoin-540bf8aacc50aae0ea5beb76511905a7d2a3e15f.tar.xz
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
-rw-r--r--src/rpc/rawtransaction.cpp1
-rw-r--r--src/wallet/rpcwallet.cpp6
2 files changed, 3 insertions, 4 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index 314184ab06..23845ff517 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -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;
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index b108d6df53..81b40aebb7 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -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;
@@ -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();
@@ -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)) {