Changeset View
Changeset View
Standalone View
Standalone View
src/rest.cpp
Show First 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | static bool rest_block(const Config &config, HTTPRequest *req, | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
tip = chainActive.Tip(); | tip = chainActive.Tip(); | ||||
pblockindex = LookupBlockIndex(hash); | pblockindex = 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 (fHavePruned && !pblockindex->nStatus.hasData() && | if (IsBlockPruned(pblockindex)) { | ||||
pblockindex->nTx > 0) { | |||||
return RESTERR(req, HTTP_NOT_FOUND, | return RESTERR(req, HTTP_NOT_FOUND, | ||||
hashStr + " not available (pruned data)"); | hashStr + " not available (pruned data)"); | ||||
} | } | ||||
if (!ReadBlockFromDisk(block, pblockindex, | if (!ReadBlockFromDisk(block, pblockindex, | ||||
config.GetChainParams().GetConsensus())) { | config.GetChainParams().GetConsensus())) { | ||||
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found"); | return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 437 Lines • Show Last 20 Lines |