Skip to content

Commit c75e3d2

Browse files
committed
rest: reduce LOCK(cs_main) scope in rest_block
1 parent 0596aa4 commit c75e3d2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/rest.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,10 @@ static bool rest_block(const std::any& context,
305305
if (chainman.m_blockman.IsBlockPruned(pblockindex))
306306
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not available (pruned data)");
307307

308-
if (!ReadBlockFromDisk(block, pblockindex, chainman.GetParams().GetConsensus()))
309-
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found");
308+
}
309+
310+
if (!ReadBlockFromDisk(block, pblockindex, chainman.GetParams().GetConsensus())) {
311+
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found");
310312
}
311313

312314
switch (rf) {

0 commit comments

Comments
 (0)