| 1039 | } |
| 1040 | |
| 1041 | static CBlock GetBlockChecked(const CBlockIndex* pblockindex) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) |
| 1042 | { |
| 1043 | AssertLockHeld(::cs_main); |
| 1044 | CBlock block; |
| 1045 | if (IsBlockPruned(pblockindex)) { |
| 1046 | throw JSONRPCError(RPC_MISC_ERROR, "Block not available (pruned data)"); |
| 1047 | } |
| 1048 | |
| 1049 | if (!ReadBlockFromDisk(block, pblockindex, Params().GetConsensus())) { |
| 1050 | // Block not found on disk. This could be because we have the block |
| 1051 | // header in our index but not yet have the block or did not accept the |
| 1052 | // block. |
| 1053 | throw JSONRPCError(RPC_MISC_ERROR, "Block not found on disk"); |
| 1054 | } |
| 1055 | |
| 1056 | return block; |
| 1057 | } |
| 1058 | |
| 1059 | static CBlockUndo GetUndoChecked(const CBlockIndex* pblockindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main) |
| 1060 | { |
no test coverage detected