Skip to content

Commit d7f61e7

Browse files
committed
rpc: reduce LOCK(cs_main) scope in gettxoutproof
1 parent 4d92b5a commit d7f61e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rpc/txoutproof.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ static RPCHelpMan gettxoutproof()
8484
g_txindex->BlockUntilSyncedToCurrentChain();
8585
}
8686

87-
LOCK(cs_main);
88-
8987
if (pblockindex == nullptr) {
9088
const CTransactionRef tx = GetTransaction(/*block_index=*/nullptr, /*mempool=*/nullptr, *setTxids.begin(), chainman.GetConsensus(), hashBlock);
9189
if (!tx || hashBlock.IsNull()) {
9290
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not yet in block");
9391
}
92+
93+
LOCK(cs_main);
9494
pblockindex = chainman.m_blockman.LookupBlockIndex(hashBlock);
9595
if (!pblockindex) {
9696
throw JSONRPCError(RPC_INTERNAL_ERROR, "Transaction index corrupt");

0 commit comments

Comments
 (0)