aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Toth <andrewstoth@gmail.com>2022-10-13 15:19:57 -0400
committerAndrew Toth <andrewstoth@gmail.com>2022-12-06 15:07:04 -0500
commitc75e3d2772b00acc3850f72a8cb733a0345aa773 (patch)
tree89dc486120e1500a3f69ed51be51d54b23a3a1a2 /src
parent0596aa40f77a630d8a21035856fa5fd6838b292e (diff)
rest: reduce LOCK(cs_main) scope in rest_block
Diffstat (limited to 'src')
-rw-r--r--src/rest.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rest.cpp b/src/rest.cpp
index a10d8a433f..033e93468e 100644
--- a/src/rest.cpp
+++ b/src/rest.cpp
@@ -305,8 +305,10 @@ static bool rest_block(const std::any& context,
if (chainman.m_blockman.IsBlockPruned(pblockindex))
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not available (pruned data)");
- if (!ReadBlockFromDisk(block, pblockindex, chainman.GetParams().GetConsensus()))
- return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found");
+ }
+
+ if (!ReadBlockFromDisk(block, pblockindex, chainman.GetParams().GetConsensus())) {
+ return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found");
}
switch (rf) {