'Validates this transaction
:param transaction the transaction to validate
:param database: the database to check against
:return: A tuple consisting of a ValidationResult and a list of user string errors'

def validate_transaction(self, database):

    result = [ValidationResult.valid]
    errors = []
    def err(reason):
        result[0] = ValidationResult.invalid
        errors.append(reason)
    if (self.transaction['up'] < 0):
        err('Up    field    is    negative')
    if (self.transaction['down'] < 0):
        err('Down    field    is    negative')
    if ((self.transaction['down'] == 0) and (self.transaction['up'] == 0)):
        err('Up    and    down    are    zero')
    if (self.transaction['total_up'] < 0):
        err('Total    up    field    is    negative')
    if (self.transaction['total_down'] < 0):
        err('Total    down    field    is    negative')
    blk = database.get(self.public_key, self.sequence_number)
    link = database.get_linked(self)
    prev_blk = database.get_block_before(self)
    next_blk = database.get_block_after(self)
    is_genesis = ((self.sequence_number == GENESIS_SEQ) or (self.previous_hash == GENESIS_HASH))
    if is_genesis:
        if (self.transaction['total_up'] != self.transaction['up']):
            err('Genesis    block    invalid    total_up    and/or    up')
        if (self.transaction['total_down'] != self.transaction['down']):
            err('Genesis    block    invalid    total_down    and/or    down')
    if blk:
        if (blk.transaction['up'] != self.transaction['up']):
            err('Up    does    not    match    known    block')
        if (blk.transaction['down'] != self.transaction['down']):
            err('Down    does    not    match    known    block')
        if (blk.transaction['total_up'] != self.transaction['total_up']):
            err('Total    up    does    not    match    known    block')
        if (blk.transaction['total_down'] != self.transaction['total_down']):
            err('Total    down    does    not    match    known    block')
    if link:
        if (self.transaction['up'] != link.transaction['down']):
            err('Up/down    mismatch    on    linked    block')
        if (self.transaction['down'] != link.transaction['up']):
            err('Down/up    mismatch    on    linked    block')
    if prev_blk:
        if ((prev_blk.transaction['total_up'] + self.transaction['up']) > self.transaction['total_up']):
            err('Total    up    is    lower    than    expected    compared    to    the    preceding    block')
        if ((prev_blk.transaction['total_down'] + self.transaction['down']) > self.transaction['total_down']):
            err('Total    down    is    lower    than    expected    compared    to    the    preceding    block')
    if next_blk:
        if ((self.transaction['total_up'] + next_blk.transaction['up']) > next_blk.transaction['total_up']):
            err('Total    up    is    higher    than    expected    compared    to    the    next    block')
        if ((self.transaction['total_down'] + next_blk.transaction['down']) > next_blk.transaction['total_down']):
            err('Total    down    is    higher    than    expected    compared    to    the    next    block')
    return (result[0], errors)
