Changeset View
Changeset View
Standalone View
Standalone View
src/rest.cpp
| Show First 20 Lines • Show All 300 Lines • ▼ Show 20 Lines | static bool rest_block(const Config &config, const std::any &context, | ||||
| ChainstateManager &chainman = *maybe_chainman; | ChainstateManager &chainman = *maybe_chainman; | ||||
| { | { | ||||
| LOCK(cs_main); | LOCK(cs_main); | ||||
| tip = chainman.ActiveTip(); | tip = chainman.ActiveTip(); | ||||
| pblockindex = chainman.m_blockman.LookupBlockIndex(hash); | pblockindex = chainman.m_blockman.LookupBlockIndex(hash); | ||||
| if (!pblockindex) { | if (!pblockindex) { | ||||
| return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found"); | return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found"); | ||||
| } | } | ||||
| if (chainman.m_blockman.IsBlockPruned(*pblockindex)) { | |||||
| if (chainman.m_blockman.IsBlockPruned(pblockindex)) { | |||||
| return RESTERR(req, HTTP_NOT_FOUND, | return RESTERR(req, HTTP_NOT_FOUND, | ||||
| hashStr + " not available (pruned data)"); | hashStr + " not available (pruned data)"); | ||||
| } | } | ||||
| } | } | ||||
| if (!chainman.m_blockman.ReadBlockFromDisk(block, *pblockindex)) { | if (!chainman.m_blockman.ReadBlockFromDisk(block, *pblockindex)) { | ||||
| return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found"); | return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found"); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 530 Lines • Show Last 20 Lines | |||||