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

Function GetBlockChecked

src/rpc/blockchain.cpp:696–711  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

694}
695
696static CBlock GetBlockChecked(BlockManager& blockman, const CBlockIndex& blockindex)
697{
698 CBlock block;
699 {
700 LOCK(cs_main);
701 CheckBlockDataAvailability(blockman, blockindex, /*check_for_undo=*/false);
702 }
703
704 if (!blockman.ReadBlock(block, blockindex)) {
705 // Block not found on disk. This shouldn't normally happen unless the block was
706 // pruned right after we released the lock above.
707 throw JSONRPCError(RPC_MISC_ERROR, "Block not found on disk");
708 }
709
710 return block;
711}
712
713static std::vector<std::byte> GetRawBlockChecked(BlockManager& blockman, const CBlockIndex& blockindex)
714{

Callers 3

getblockstatsFunction · 0.85
CheckBlockFilterMatchesFunction · 0.85
getdescriptoractivityFunction · 0.85

Calls 3

JSONRPCErrorFunction · 0.85
ReadBlockMethod · 0.45

Tested by

no test coverage detected