Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 842 Lines • ▼ Show 20 Lines | static UniValue getblockheader(const Config &config, | ||||
} | } | ||||
return blockheaderToJSON(chainActive.Tip(), pblockindex); | return blockheaderToJSON(chainActive.Tip(), pblockindex); | ||||
} | } | ||||
static CBlock GetBlockChecked(const Config &config, | static CBlock GetBlockChecked(const Config &config, | ||||
const CBlockIndex *pblockindex) { | const CBlockIndex *pblockindex) { | ||||
CBlock block; | CBlock block; | ||||
if (fHavePruned && !pblockindex->nStatus.hasData() && | if (IsBlockPruned(pblockindex)) { | ||||
pblockindex->nTx > 0) { | |||||
throw JSONRPCError(RPC_MISC_ERROR, "Block not available (pruned data)"); | throw JSONRPCError(RPC_MISC_ERROR, "Block not available (pruned data)"); | ||||
} | } | ||||
if (!ReadBlockFromDisk(block, pblockindex, | if (!ReadBlockFromDisk(block, pblockindex, | ||||
config.GetChainParams().GetConsensus())) { | config.GetChainParams().GetConsensus())) { | ||||
// Block not found on disk. This could be because we have the block | // Block not found on disk. This could be because we have the block | ||||
// header in our index but don't have the block (for example if a | // header in our index but don't have the block (for example if a | ||||
// non-whitelisted node sends us an unrequested long chain of valid | // non-whitelisted node sends us an unrequested long chain of valid | ||||
▲ Show 20 Lines • Show All 1,675 Lines • Show Last 20 Lines |