aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Toth <andrewstoth@gmail.com>2022-10-17 09:12:20 -0400
committerAndrew Toth <andrewstoth@gmail.com>2022-12-06 15:07:04 -0500
commitd7f61e7d5909da7227c9e34be06ce9eb872ba074 (patch)
tree4836925030d79a702945e5a9e42b630fc1beab02 /src
parent4d92b5aabaf371225cdc37a7b114adc040bf4da5 (diff)
rpc: reduce LOCK(cs_main) scope in gettxoutproof
Diffstat (limited to 'src')
-rw-r--r--src/rpc/txoutproof.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rpc/txoutproof.cpp b/src/rpc/txoutproof.cpp
index cd8b49bfe1..8c5468634d 100644
--- a/src/rpc/txoutproof.cpp
+++ b/src/rpc/txoutproof.cpp
@@ -84,13 +84,13 @@ static RPCHelpMan gettxoutproof()
g_txindex->BlockUntilSyncedToCurrentChain();
}
- LOCK(cs_main);
-
if (pblockindex == nullptr) {
const CTransactionRef tx = GetTransaction(/*block_index=*/nullptr, /*mempool=*/nullptr, *setTxids.begin(), chainman.GetConsensus(), hashBlock);
if (!tx || hashBlock.IsNull()) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not yet in block");
}
+
+ LOCK(cs_main);
pblockindex = chainman.m_blockman.LookupBlockIndex(hashBlock);
if (!pblockindex) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "Transaction index corrupt");