Commit message · SomberNightwallet_db: convert_version_74: duplicate map from lnutil for robustness
Previously we assumed `DERIVED_LOCAL_BASEPOINTS` would never change in future code.
```diff
diff --git a/electrum/lnutil.py b/electrum/lnutil.py
index efded00e80..b0b400d965 100644
--- a/electrum/lnutil.py
+++ b/electrum/lnutil.py
@@ -2131,6 +2133,7 @@ DERIVED_LOCAL_BASEPOINTS = {
'htlc_basepoint': LnKeyFamily.HTLC_BASE,
'delayed_basepoint': LnKeyFamily.DELAY_BASE,
'revocation_basepoint': LnKeyFamily.REVOCATION_BASE,
+ 'xx': LnKeyFamily.FUNDING_ROOT_KEY,
}
```
```
Traceback (most recent call last):
File "/home/user/wspace/electrum/electrum/gui/qt/__init__.py", line 441, in start_new_window
wallet = self._start_wizard_to_select_or_create_wallet(path)
File "/home/user/wspace/electrum/electrum/gui/qt/__init__.py", line 513, in _start_wizard_to_select_or_create_wallet
wallet = self.daemon.load_wallet(wallet_file, password, upgrade=True)
File "/home/user/wspace/electrum/electrum/daemon.py", line 496, in func_wrapper
return func(self, *args, **kwargs)
File "/home/user/wspace/electrum/electrum/daemon.py", line 522, in load_wallet
wallet = self._load_wallet(
path, password, upgrade=upgrade, config=self.config, force_check_password=force_check_password)
File "/home/user/wspace/electrum/electrum/util.py", line 518, in do_profile
o = func(*args, **kw_args)
File "/home/user/wspace/electrum/electrum/daemon.py", line 556, in _load_wallet
db = WalletDB(storage.read(), storage=storage, upgrade=upgrade)
File "/home/user/wspace/electrum/electrum/wallet_db.py", line 1714, in __init__
JsonDB.__init__(
~~~~~~~~~~~~~~~^
self,
^^^^^
...<3 lines>...
upgrader=partial(upgrade_wallet_db, do_upgrade=upgrade),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/home/user/wspace/electrum/electrum/json_db.py", line 107, in __init__
data, was_upgraded = upgrader(data)
~~~~~~~~^^^^^^
File "/home/user/wspace/electrum/electrum/wallet_db.py", line 1698, in upgrade_wallet_db
dbu.upgrade()
~~~~~~~~~~~^^
File "/home/user/wspace/electrum/electrum/util.py", line 518, in do_profile
o = func(*args, **kw_args)
File "/home/user/wspace/electrum/electrum/wallet_db.py", line 266, in upgrade
self._convert_version_74()
~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/user/wspace/electrum/electrum/wallet_db.py", line 1548, in _convert_version_74
check(channel_id, name, keypair.privkey, local_config[name].pop('privkey'))
~~~~~~~~~~~~^^^^^^
KeyError: 'xx'
```
73/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
Why it was queuedsigning or wallet pathsecond-pass: broader security terminologysecond-pass: security-sensitive path
AI analysis · Low 27/100This commit fixes a wallet-upgrade bug, not a security vulnerability. Electrum's database upgrade code for old Lightning wallets imported a list of 'basepoints' (cryptographic key derivation points) from another file. When that other file later gained a new entry, the upgrade code broke with a KeyError and users could not open their wallets. The fix copies the exact list of basepoints needed for the upgrade directly into the upgrade function so future changes elsewhere cannot break it. There is no attacker-controlled path and no theft or code-execution risk.