mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-04 13:55:23 -05:00
rest: improve error when only header of a block is available.
This avoids calling ReadRawBlockFromDisk() when the block is expected not to be available because we haven't downloaded it yet and only know the header.
This commit is contained in:
parent
cf0120ff02
commit
e5b537bbdf
1 changed files with 5 additions and 2 deletions
|
@ -309,8 +309,11 @@ static bool rest_block(const std::any& context,
|
|||
if (!pblockindex) {
|
||||
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found");
|
||||
}
|
||||
if (chainman.m_blockman.IsBlockPruned(*pblockindex)) {
|
||||
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not available (pruned data)");
|
||||
if (!(pblockindex->nStatus & BLOCK_HAVE_DATA)) {
|
||||
if (chainman.m_blockman.IsBlockPruned(*pblockindex)) {
|
||||
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not available (pruned data)");
|
||||
}
|
||||
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not available (not fully downloaded)");
|
||||
}
|
||||
pos = pblockindex->GetBlockPos();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue