def discard_unknown_and_check(self):
        """Discards unknown flags and checks flag combination."""
        flags = list_enabled_bits(self)
        known_channel_types = []
        for flag in flags:
            channel_type = ChannelType(1 << flag)
            if channel_type.name:
                known_channel_types.append(channel_type)
        final_channel_type = known_channel_types[0]
        for channel_type in known_channel_types[1:]:
            final_channel_type |= channel_type

        final_channel_type.check_combinations()
        return final_channel_type
Discards unknown flags and checks flag combination.
electrum/lnutil.py