Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 945 Lines • ▼ Show 20 Lines | static CBlock GetBlockChecked(const Config &config, | ||||
CBlock block; | CBlock block; | ||||
if (IsBlockPruned(pblockindex)) { | if (IsBlockPruned(pblockindex)) { | ||||
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 not yet have the block or did not accept the | ||||
// non-whitelisted node sends us an unrequested long chain of valid | // block. | ||||
// blocks, we add the headers to our index, but don't accept the block). | |||||
throw JSONRPCError(RPC_MISC_ERROR, "Block not found on disk"); | throw JSONRPCError(RPC_MISC_ERROR, "Block not found on disk"); | ||||
} | } | ||||
return block; | return block; | ||||
} | } | ||||
static CBlockUndo GetUndoChecked(const CBlockIndex *pblockindex) { | static CBlockUndo GetUndoChecked(const CBlockIndex *pblockindex) { | ||||
CBlockUndo blockUndo; | CBlockUndo blockUndo; | ||||
▲ Show 20 Lines • Show All 2,016 Lines • Show Last 20 Lines |