'Helper method that reconstructs a transaction dict that was returned
from the database. It checks what asset_id to retrieve, retrieves the
asset from the asset table and reconstructs the transaction.
Args:
bigchain (:class:`~bigchaindb.Bigchain`): An instance of Bigchain
used to perform database queries.
tx_dict (:obj:`dict`): The transaction dict as returned from the
database.
Returns:
:class:`~Transaction`'

@classmethod
def from_db(cls, bigchain, tx_dict):

    if (tx_dict['operation'] in [Transaction.CREATE, Transaction.GENESIS]):
        asset = list(bigchain.get_assets([tx_dict['id']]))[0]
        del asset['id']
        tx_dict.update({'asset': asset})
    return cls.from_dict(tx_dict)
