wizard: fix exception when loading new tc wallet
What changed, and why it matters
This commit fixes a crash that occurred when creating or loading a special type of Electrum wallet (a trustedcoin two-factor wallet) through the setup wizard. The crash was caused by the wallet being loaded in a way that skipped normal bookkeeping, leaving a menu list as 'None' instead of empty. The fix makes the wizard use the standard wallet-loading path and also defensively treats a missing recent-wallets list as empty. It is a bug-fix for a user-visible crash, not a security vulnerability.
No security action required; treat as a normal stability bug fix. Users on affected versions may experience a crash when setting up a trustedcoin wallet, so updating is advisable for reliability.
Security signals we found
No security-relevant signals present
Crash/DoS-like symptom (unhandled TypeError) fixed
Code path normalization (using standard load_wallet instead of manual instantiation)
Evidence from the diff
The patch resolves a TypeError in ElectrumWindow.update_recently_opened_menu() because self.config.RECENTLY_OPEN_WALLET_FILES was None for trustedcoin wallets created via the wizard. The root cause was that the wizard manually instantiated Wallet and called add_wallet(), bypassing Daemon.load_wallet(), which is responsible for updating RECENTLY_OPEN_WALLET_FILES. The fix changes the wizard to use self.daemon.load_wallet(wallet_file, password, upgrade=True) and adds a defensive ‘or []’ fallback in update_recently_opened_menu().
Changed components
electrum/gui/qt/__init__.pyelectrum/gui/qt/main_window.pyTrustedcoin wallet wizard flowDaemon wallet loading / recently-opened menuInspect captured patch +3 / −5
diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py
index 4a37fb1..a17d613 100644
--- a/electrum/gui/qt/__init__.py
+++ b/electrum/gui/qt/__init__.py
@@ -502,11 +502,9 @@ class ElectrumGui(BaseElectrumGui, Logger):
self.logger.info('wizard dialog cancelled by user')
return
db.put('x3', wizard.get_wizard_data()['x3'])
- db.write()
+ db.write_and_force_consolidation() # TODO API for db is a bit weird: there should be a close method
- wallet = Wallet(db, config=self.config)
- wallet.start_network(self.daemon.network)
- self.daemon.add_wallet(wallet)
+ wallet = self.daemon.load_wallet(wallet_file, password, upgrade=True)
return wallet
def close_window(self, window: ElectrumWindow):
diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
index fe4e7fb..ab58d30 100644
--- a/electrum/gui/qt/main_window.py
+++ b/electrum/gui/qt/main_window.py
@@ -736,7 +736,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
return True
def update_recently_opened_menu(self):
- recent = self.config.RECENTLY_OPEN_WALLET_FILES
+ recent = self.config.RECENTLY_OPEN_WALLET_FILES or []
self.recently_visited_menu.clear()
for i, k in enumerate(recent):
b = os.path.basename(k)
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.