def check_contract(self, contract, fail_without_parent=True):
        if not contract.verify():
            self.logger.debug('Contract failed check (invalid signature)')
            return False

        if contract.previous_hash and fail_without_parent:
            prev_contract = self.incoming_contracts.get(contract.previous_hash) or \
                            self.data_manager.get_contract(contract.previous_hash)

            if prev_contract is None:
                self.logger.error('Contract failed check (parent is unknown)')
                return False

        return True