Decorator for the check() method on token operations.
    Make sure that there is a __account_payment_info__ and __account_credit_info__ set.

def token_operation(table_name):
    """
    Decorator for the check() method on token operations.
    Make sure that there is a __account_payment_info__ and __account_credit_info__ set.
    """
    def wrap( check ):
        def wrapped_check( state_engine, token_op, block_id, checked_ops ):
            rc = check( state_engine, token_op, block_id, checked_ops )
            if rc:
                token_op['__table__'] = table_name
                invariant_tags = token_operation_invariant_tags()
                for tag in invariant_tags:
                    assert tag in token_op, 'BUG: missing token operation invariant tag {}'.format(tag)

                # sanity check---all required consensus fields must be present
                for required_field in CONSENSUS_FIELDS_REQUIRED:
                    assert required_field in token_op, 'BUG: missing required consensus field {}'.format(required_field)

                # sanity check---all required consensus fields for tokens must be present
                for required_field in CONSENSUS_FIELDS_REQUIRED_TOKENS:
                    assert required_field in token_op, 'BUG: missing token-specific required consensus field {}'.format(required_field)

            return rc
        return wrapped_check
    return wrap