# Buggy code
def _convert_version_24(self):
    if not self._is_upgrade_method_needed(23, 23):
        return
    channels = self.get("channels", [])
    for c in channels:
        # convert revocation store to dict
        r = c["revocation_store"]
        d = {}
        for i in range(49):
            v = r["buckets"][i]
            if v is not None:
                d[str(i)] = v
        r["buckets"] = d
        c["revocation_store"] = r
    # convert channels to dict
    self.data["channels"] = {x["channel_id"]: x for x in channels}
    # convert txi & txo
    txi = self.get("txi", {})
    for tx_hash, d in txi.items():
        d2 = {}
        for addr, l in d.items():
            d2[addr] = {}
            for ser, v in l:
                d2[addr][ser] = v
        txi[tx_hash] = d2
    self.data["txi"] = txi
    txo = self.get("txo", {})
    for tx_hash, d in txo.items():
        d2 = {}
        for addr, l in d.items():
            d2[addr] = {}
            for n, v, cb in l:
                d2[addr][str(n)] = (v, cb)
        txo[tx_hash] = d2
    self.data["txo"] = txo

    self.data["seed_version"] = 24


# Traceback (ValueError)
qt5ct: using qt5ct plugin
qt5ct: D-Bus system tray: yes
E | daemon.Daemon | GUI raised exception: ValueError('too many values to unpack (expected 2)'). shutting down.
E | __main__ | daemon.run_gui errored
Traceback (most recent call last):
File "/home/tippet/.local/lib/python3.8/site-packages/electrum/gui/qt/__init__.py", line 245, in wrapper
return func(self, *args, **kwargs)
File "/home/tippet/.local/lib/python3.8/site-packages/electrum/gui/qt/__init__.py", line 269, in start_new_window
wallet = self._start_wizard_to_select_or_create_wallet(path)
File "/home/tippet/.local/lib/python3.8/site-packages/electrum/gui/qt/__init__.py", line 314, in _start_wizard_to_select_or_create_wallet
db = WalletDB(storage.read(), manual_upgrades=False)
File "/home/tippet/.local/lib/python3.8/site-packages/electrum/wallet_db.py", line 72, in __init__
self.load_data(raw)
File "/home/tippet/.local/lib/python3.8/site-packages/electrum/wallet_db.py", line 105, in load_data
self.upgrade()
File "/home/tippet/.local/lib/python3.8/site-packages/electrum/util.py", line 408, in <lambda>
return lambda *args, **kw_args: do_profile(args, kw_args)
File "/home/tippet/.local/lib/python3.8/site-packages/electrum/util.py", line 404, in do_profile
o = func(*args, **kw_args)
File "/home/tippet/.local/lib/python3.8/site-packages/electrum/wallet_db.py", line 174, in upgrade
self._convert_version_24()
File "/home/tippet/.local/lib/python3.8/site-packages/electrum/wallet_db.py", line 531, in _convert_version_24
for ser, v in l:
ValueError: too many values to unpack (expected 2)

Additional information
Electrum version: 4.0.8
Python version: 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]
Operating system: Linux-5.4.0-58-generic-x86_64-with-glibc2.29
Wallet type: standard
Locale: en_US

# Fixed code
def _convert_version_24(self):
    if not self._is_upgrade_method_needed(23, 23):
        return
    channels = self.get("channels", [])
    for c in channels:
        # convert revocation store to dict
        r = c["revocation_store"]
        d = {}
        for i in range(49):
            v = r["buckets"][i]
            if v is not None:
                d[str(i)] = v
        r["buckets"] = d
        c["revocation_store"] = r
    # convert channels to dict
    self.data["channels"] = {x["channel_id"]: x for x in channels}
    # convert txi & txo
    txi = self.get("txi", {})
    for tx_hash, d in list(txi.items()):
        d2 = {}
        for addr, l in d.items():
            d2[addr] = {}
            for ser, v in l:
                d2[addr][ser] = v
        txi[tx_hash] = d2
    self.data["txi"] = txi
    txo = self.get("txo", {})
    for tx_hash, d in list(txo.items()):
        d2 = {}
        for addr, l in d.items():
            d2[addr] = {}
            for n, v, cb in l:
                d2[addr][str(n)] = (v, cb)
        txo[tx_hash] = d2
    self.data["txo"] = txo

    self.data["seed_version"] = 24