rpc: reduce LOCK(cs_main) scope in gettxoutproof
This commit is contained in:
1 parent
4d92b5aaba
commit
d7f61e7d59
1 file changed
+2
-2
@@ -84,13 +84,13 @@ static RPCHelpMan gettxoutproof()
|
|||||||
g_txindex->BlockUntilSyncedToCurrentChain();
|
g_txindex->BlockUntilSyncedToCurrentChain();
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCK(cs_main);
|
|
||||||
|
|
||||||
if (pblockindex == nullptr) {
|
if (pblockindex == nullptr) {
|
||||||
const CTransactionRef tx = GetTransaction(/*block_index=*/nullptr, /*mempool=*/nullptr, *setTxids.begin(), chainman.GetConsensus(), hashBlock);
|
const CTransactionRef tx = GetTransaction(/*block_index=*/nullptr, /*mempool=*/nullptr, *setTxids.begin(), chainman.GetConsensus(), hashBlock);
|
||||||
if (!tx || hashBlock.IsNull()) {
|
if (!tx || hashBlock.IsNull()) {
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not yet in block");
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not yet in block");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOCK(cs_main);
|
||||||
pblockindex = chainman.m_blockman.LookupBlockIndex(hashBlock);
|
pblockindex = chainman.m_blockman.LookupBlockIndex(hashBlock);
|
||||||
if (!pblockindex) {
|
if (!pblockindex) {
|
||||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Transaction index corrupt");
|
throw JSONRPCError(RPC_INTERNAL_ERROR, "Transaction index corrupt");
|
||||||
|
|||||||
Reference in new issue
Block a user