@api_request
@reply_type([ProtocolMessageTypes.respond_block, ProtocolMessageTypes.reject_block])
async def request_block(self, request: full_node_protocol.RequestBlock) -> Optional[Message]:
    if (not self.full_node.blockchain.contains_height(request.height)):
        reject = RejectBlock(request.height)
        msg = make_msg(ProtocolMessageTypes.reject_block, reject)
        return msg
    header_hash: Optional[bytes32] = self.full_node.blockchain.height_to_hash(request.height)
    if (header_hash is None):
        return make_msg(ProtocolMessageTypes.reject_block, RejectBlock(request.height))
    block: Optional[FullBlock] = (await self.full_node.block_store.get_full_block(header_hash))
    if (block is not None):
        if ((not request.include_transaction_block) and (block.transactions_generator is not None)):
            block = dataclasses.replace(block, transactions_generator=None)
        return make_msg(ProtocolMessageTypes.respond_block, full_node_protocol.RespondBlock(block))
    return make_msg(ProtocolMessageTypes.reject_block, RejectBlock(request.height))
@api_request
@reply_type([ProtocolMessageTypes.respond_block, ProtocolMessageTypes.reject_block])
async def request_block(self, request: full_node_protocol.RequestBlock) -> Optional[Message]:
    if (not self.full_node.blockchain.contains_height(request.height)):
        reject = RejectBlock(request.height)
        msg = make_msg(ProtocolMessageTypes.reject_block, reject)
        return msg
    header_hash: Optional[bytes32] = self.full_node.blockchain.height_to_hash(request.height)
    if (header_hash is None):
        return make_msg(ProtocolMessageTypes.reject_block, RejectBlock(request.height))
    block: Optional[FullBlock] = (await self.full_node.block_store.get_full_block(header_hash))
    if (block is not None):
        if ((not request.include_transaction_block) and (block.transactions_generator is not None)):
            block = dataclasses.replace(block, transactions_generator=None)
        return make_msg(ProtocolMessageTypes.respond_block, full_node_protocol.RespondBlock(block))
    return make_msg(ProtocolMessageTypes.reject_block, RejectBlock(request.height))