ServerConnectWizard: use default server instead of ''
What changed, and why it matters
This commit fixes a small bug in Electrum's setup wizard where, if a user chose to manually configure a server but left the field empty or invalid, the wizard would pass an empty string as the server address. That could cause a crash (traceback). The fix falls back to the default server instead of an empty string and logs a warning rather than silently returning. It is a stability fix, not a security vulnerability.
Treat as a routine bug-fix / stability patch. No urgent security action required. Users on affected versions should update through normal channels if they experience wizard crashes.
Security signals we found
Crash/DoS hardening: prevents a traceback in the server-connect wizard
Input validation: replaces silent exception swallowing with explicit logging and fallback to default server
No evidence of malicious control flow, privilege escalation, or data exposure
Evidence from the diff
In ServerConnectWizard.do_configure_server(), the code previously set server=’’ and then, on parse failure, returned without configuring anything. The patch initializes server=None, parses the user-supplied server address, and if parsing fails logs a warning and returns, leaving the network to use its default. If parsing succeeds or autoconnect is enabled, it uses server or net_params.server (the default) when building net_params. This prevents passing an empty string to Network.set_parameters(), which could trigger an exception.
Changed components
electrum/wizard.pyServerConnectWizard.do_configure_serverNetwork.set_parameters (indirectly, via call site)Inspect captured patch +10 / −8
diff --git a/electrum/wizard.py b/electrum/wizard.py
index f15ea6d..0f55165 100644
--- a/electrum/wizard.py
+++ b/electrum/wizard.py
@@ -855,16 +855,18 @@ class ServerConnectWizard(AbstractWizard):
def do_configure_server(self, wizard_data: dict):
self._logger.debug(f'configuring server: {wizard_data!r}')
net_params = self._daemon.network.get_parameters()
- server = ''
+ server = None
oneserver = wizard_data.get('one_server', False)
if not wizard_data['autoconnect']:
- try:
- server = ServerAddr.from_str_with_inference(wizard_data['server'])
- if not server:
- raise Exception('failed to parse server %s' % wizard_data['server'])
- except Exception:
- return
- net_params = net_params._replace(server=server, auto_connect=wizard_data['autoconnect'], oneserver=oneserver)
+ server = ServerAddr.from_str_with_inference(wizard_data.get('server', ''))
+ if not server:
+ self._logger.warn('failed to parse server %s' % wizard_data.get('server', ''))
+ return # Network._start() will set autoconnect and default server
+ net_params = net_params._replace(
+ server=server or net_params.server,
+ auto_connect=wizard_data['autoconnect'],
+ oneserver=oneserver,
+ )
self._daemon.network.run_from_another_thread(self._daemon.network.set_parameters(net_params))
def do_configure_autoconnect(self, wizard_data: dict):
Why this scored 17/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.