async def validate_unfinished_block(self, block: UnfinishedBlock, skip_overflow_ss_validation=True) -> PreValidationResult:
    if ((not self.contains_block(block.prev_header_hash)) and (not (block.prev_header_hash == self.constants.GENESIS_CHALLENGE))):
        return PreValidationResult(uint16(Err.INVALID_PREV_BLOCK_HASH.value), None, None)
    unfinished_header_block = UnfinishedHeaderBlock(block.finished_sub_slots, block.reward_chain_block, block.challenge_chain_sp_proof, block.reward_chain_sp_proof, block.foliage, block.foliage_transaction_block, b'')
    prev_b = self.try_block_record(unfinished_header_block.prev_header_hash)
    (sub_slot_iters, difficulty) = get_next_sub_slot_iters_and_difficulty(self.constants, (len(unfinished_header_block.finished_sub_slots) > 0), prev_b, self)
    (required_iters, error) = validate_unfinished_header_block(self.constants, self, unfinished_header_block, False, difficulty, sub_slot_iters, skip_overflow_ss_validation)
    if (error is not None):
        return PreValidationResult(uint16(error.code.value), None, None)
    prev_height = ((- 1) if (block.prev_header_hash == self.constants.GENESIS_CHALLENGE) else self.block_record(block.prev_header_hash).height)
    npc_result = None
    if (block.transactions_generator is not None):
        assert (block.transactions_info is not None)
        try:
            block_generator: Optional[BlockGenerator] = (await self.get_block_generator(block))
        except ValueError:
            return PreValidationResult(uint16(Err.GENERATOR_REF_HAS_NO_GENERATOR.value), None, None)
        if (block_generator is None):
            return PreValidationResult(uint16(Err.GENERATOR_REF_HAS_NO_GENERATOR.value), None, None)
        npc_result = get_name_puzzle_conditions(block_generator, min(self.constants.MAX_BLOCK_COST_CLVM, block.transactions_info.cost), cost_per_byte=self.constants.COST_PER_BYTE, safe_mode=False)
    (error_code, cost_result) = (await validate_block_body(self.constants, self, self.block_store, self.coin_store, self.get_peak(), block, uint32((prev_height + 1)), npc_result, None, self.get_block_generator))
    if (error_code is not None):
        return PreValidationResult(uint16(error_code.value), None, None)
    return PreValidationResult(None, required_iters, cost_result)
async def validate_unfinished_block(self, block: UnfinishedBlock, skip_overflow_ss_validation=True) -> PreValidationResult:
    if ((not self.contains_block(block.prev_header_hash)) and (not (block.prev_header_hash == self.constants.GENESIS_CHALLENGE))):
        return PreValidationResult(uint16(Err.INVALID_PREV_BLOCK_HASH.value), None, None)
    unfinished_header_block = UnfinishedHeaderBlock(block.finished_sub_slots, block.reward_chain_block, block.challenge_chain_sp_proof, block.reward_chain_sp_proof, block.foliage, block.foliage_transaction_block, b)
    prev_b = self.try_block_record(unfinished_header_block.prev_header_hash)
    (sub_slot_iters, difficulty) = get_next_sub_slot_iters_and_difficulty(self.constants, (len(unfinished_header_block.finished_sub_slots) > 0), prev_b, self)
    (required_iters, error) = validate_unfinished_header_block(self.constants, self, unfinished_header_block, False, difficulty, sub_slot_iters, skip_overflow_ss_validation)
    if (error is not None):
        return PreValidationResult(uint16(error.code.value), None, None)
    prev_height = ((- 1) if (block.prev_header_hash == self.constants.GENESIS_CHALLENGE) else self.block_record(block.prev_header_hash).height)
    npc_result = None
    if (block.transactions_generator is not None):
        assert (block.transactions_info is not None)
        try:
            block_generator: Optional[BlockGenerator] = (await self.get_block_generator(block))
        except ValueError:
            return PreValidationResult(uint16(Err.GENERATOR_REF_HAS_NO_GENERATOR.value), None, None)
        if (block_generator is None):
            return PreValidationResult(uint16(Err.GENERATOR_REF_HAS_NO_GENERATOR.value), None, None)
        npc_result = get_name_puzzle_conditions(block_generator, min(self.constants.MAX_BLOCK_COST_CLVM, block.transactions_info.cost), cost_per_byte=self.constants.COST_PER_BYTE, safe_mode=False)
    (error_code, cost_result) = (await validate_block_body(self.constants, self, self.block_store, self.coin_store, self.get_peak(), block, uint32((prev_height + 1)), npc_result, None, self.get_block_generator))
    if (error_code is not None):
        return PreValidationResult(uint16(error_code.value), None, None)
    return PreValidationResult(None, required_iters, cost_result)