| 785 | } |
| 786 | |
| 787 | static 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 | |
| 806 | static UniValue getblock(const JSONRPCRequest& request) |
| 807 | { |
no test coverage detected