| 711 | } |
| 712 | |
| 713 | static std::vector<std::byte> GetRawBlockChecked(BlockManager& blockman, const CBlockIndex& blockindex) |
| 714 | { |
| 715 | FlatFilePos pos{}; |
| 716 | { |
| 717 | LOCK(cs_main); |
| 718 | CheckBlockDataAvailability(blockman, blockindex, /*check_for_undo=*/false); |
| 719 | pos = blockindex.GetBlockPos(); |
| 720 | } |
| 721 | |
| 722 | if (auto data{blockman.ReadRawBlock(pos)}) return std::move(*data); |
| 723 | // Block not found on disk. This shouldn't normally happen unless the block was |
| 724 | // pruned right after we released the lock above. |
| 725 | throw JSONRPCError(RPC_MISC_ERROR, "Block not found on disk"); |
| 726 | } |
| 727 | |
| 728 | static CBlockUndo GetUndoChecked(BlockManager& blockman, const CBlockIndex& blockindex) |
| 729 | { |
no test coverage detected