rpc: remove cs_main lock from `createrawtransaction`
This is a pure utility function that doesn't use main's data structures, so it does not require that lock. zcash: cs_main still needed while calling chainActive() zcash: cherry picked 6e765873605ee5e31652ce107848a157151791b4 zcash: https://github.com/bitcoin/bitcoin/pull/7156
This commit is contained in:
parent
bc3da48a11
commit
2713f9680d
|
@ -573,7 +573,6 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
|
|||
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\"")
|
||||
);
|
||||
|
||||
LOCK(cs_main);
|
||||
RPCTypeCheck(params, boost::assign::list_of(UniValue::VARR)(UniValue::VOBJ)(UniValue::VNUM)(UniValue::VNUM), true);
|
||||
if (params[0].isNull() || params[1].isNull())
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, arguments 1 and 2 must be non-null");
|
||||
|
@ -581,7 +580,11 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
|
|||
UniValue inputs = params[0].get_array();
|
||||
UniValue sendTo = params[1].get_obj();
|
||||
|
||||
int nextBlockHeight = chainActive.Height() + 1;
|
||||
int nextBlockHeight;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
nextBlockHeight = chainActive.Height() + 1;
|
||||
}
|
||||
CMutableTransaction rawTx = CreateNewContextualCMutableTransaction(
|
||||
Params().GetConsensus(), nextBlockHeight);
|
||||
|
||||
|
|
Loading…
Reference in New Issue