def verify_invoke(self, builder: 'BlockBuilder', block: 'Block', prev_block: 'Block'):
    header: BlockHeader = block.header
    try:
        (new_block, invoke_result) = self.invoke_func(block, prev_block)
    except GenericJsonRpcServerError as e:
        if (hasattr(e, 'message') and ('Failed to invoke a block' in e.message)):
            e = ScoreInvokeError(f'{e.message} with block({header.hash.hex()})')
        self._handle_exception(e)
    except Exception as e:
        self._handle_exception(e)
    else:
        if ((not header.commit_state) and (len(block.body.transactions) == 0)):
            pass
        elif (header.commit_state != new_block.header.commit_state):
            exception = ScoreInvokeResultError(f'Block({header.height}, {header.hash.hex()}, CommitState({header.commit_state}), Expected({new_block.header.commit_state}).')
            self._handle_exception(exception)
def verify_invoke(self, builder: 'BlockBuilder', block: 'Block', prev_block: 'Block'):
    header: BlockHeader = block.header
    try:
        (new_block, invoke_result) = self.invoke_func(block, prev_block)
    except GenericJsonRpcServerError as e:
        if (hasattr(e, 'message') and ('Failed to invoke a block' in e.message)):
            e = ScoreInvokeError(f'{e.message} with block({header.hash.hex()})')
        self._handle_exception(e)
    except Exception as e:
        self._handle_exception(e)
    else:
        if ((not header.commit_state) and (len(block.body.transactions) == 0)):
            pass
        elif (header.commit_state != new_block.header.commit_state):
            exception = ScoreInvokeResultError(f'Block({header.height}, {header.hash.hex()}, CommitState({header.commit_state}), Expected({new_block.header.commit_state}).')
            self._handle_exception(exception)