Remove unnecessary fields for an operation, i.e. prior to committing it.
        This includes any invariant tags we've added with our invariant decorators
        (such as @state_create or @state_transition).
        
        TODO: less ad-hoc way to do this

def sanitize_op( self, op_data ):
        """
        Remove unnecessary fields for an operation, i.e. prior to committing it.
        This includes any invariant tags we've added with our invariant decorators
        (such as @state_create or @state_transition).
        
        TODO: less ad-hoc way to do this
        """
        
        op_data = super(BlockstackDB, self).sanitize_op(op_data)

        # remove invariant tags (i.e. added by our invariant state_* decorators)
        to_remove = get_state_invariant_tags()
        for tag in to_remove:
            if tag in op_data.keys():
                del op_data[tag]

        # NOTE: this is called the opcode family, because
        # different operation names can have the same operation code
        # (such as NAME_RENEWAL and NAME_REGISTRATION).  They must
        # have the same mutation fields.
        opcode_family = op_get_opcode_name( op_data['op'] )

        # for each column in the appropriate state table,
        # if the column is not identified in the operation's
        # MUTATE_FIELDS list, then set it to None here.
        mutate_fields = op_get_mutate_fields( opcode_family )
        for mf in mutate_fields:
            if not op_data.has_key( mf ):
                log.debug("Adding NULL mutate field '%s.%s'" % (opcode_family, mf ))
                op_data[mf] = None

        # TODO: less ad-hoc
        for extra_field in ['opcode']:
            if extra_field in op_data:
                del op_data[extra_field]

        return op_data