diff options
author | Andrew Toth <andrewstoth@gmail.com> | 2022-10-13 15:19:57 -0400 |
---|---|---|
committer | Andrew Toth <andrewstoth@gmail.com> | 2022-12-06 15:07:04 -0500 |
commit | c75e3d2772b00acc3850f72a8cb733a0345aa773 (patch) | |
tree | 89dc486120e1500a3f69ed51be51d54b23a3a1a2 /src/rest.cpp | |
parent | 0596aa40f77a630d8a21035856fa5fd6838b292e (diff) | |
download | bitcoin-c75e3d2772b00acc3850f72a8cb733a0345aa773.tar.xz |
rest: reduce LOCK(cs_main) scope in rest_block
Diffstat (limited to 'src/rest.cpp')
-rw-r--r-- | src/rest.cpp | 6 |
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) { |