MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / GetBlockChecked

Function GetBlockChecked

src/rpc/blockchain.cpp:787–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

785}
786
787static CBlock GetBlockChecked(const CBlockIndex* pblockindex)
788{
789 CBlock block;
790 if (IsBlockPruned(pblockindex)) {
791 throw JSONRPCError(RPC_MISC_ERROR, "Block not available (pruned data)");
792 }
793
794 if (!ReadBlockFromDisk(block, pblockindex, Params().GetConsensus())) {
795 // Block not found on disk. This could be because we have the block
796 // header in our index but don't have the block (for example if a
797 // non-whitelisted node sends us an unrequested long chain of valid
798 // blocks, we add the headers to our index, but don't accept the
799 // block).
800 throw JSONRPCError(RPC_MISC_ERROR, "Block not found on disk");
801 }
802
803 return block;
804}
805
806static UniValue getblock(const JSONRPCRequest& request)
807{

Callers 2

getblockFunction · 0.85
getblockstatsFunction · 0.85

Calls 4

IsBlockPrunedFunction · 0.85
JSONRPCErrorFunction · 0.85
ReadBlockFromDiskFunction · 0.85
ParamsClass · 0.50

Tested by

no test coverage detected