qml: qenetwork: fix type confusion for "server"

exc triggered when switching from same server to same server:
```
  9.43 | D | gui.qml.qenetwork | server_status updated: Connecting
  9.43 | E | network | Exception in _run_new_interface: Exception('diagnostic name not yet available?')
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/logging.py", line 241, in __get_logger_for_obj
    diag_name = self.diagnostic_name()
  File "/home/user/wspace/electrum/electrum/interface.py", line 555, in diagnostic_name
    return self.server.net_addr_str()
AttributeError: 'str' object has no attribute 'net_addr_str'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/util.py", line 1218, in wrapper
    return await func(*args, **kwargs)
  File "/home/user/wspace/electrum/electrum/network.py", line 986, in _run_new_interface
    interface = Interface(network=self, server=server)
  File "/home/user/wspace/electrum/electrum/interface.py", line 502, in __init__
    Logger.__init__(self)
  File "/home/user/wspace/electrum/electrum/logging.py", line 232, in __init__
    self.logger = self.__get_logger_for_obj()
  File "/home/user/wspace/electrum/electrum/logging.py", line 243, in __get_logger_for_obj
    raise Exception("diagnostic name not yet available?") from e
Exception: diagnostic name not yet available?
```
This commit is contained in:
SomberNight
2025-07-18 14:16:30 +00:00
parent 159d83905b
commit eef562389c
4 changed files with 9 additions and 8 deletions

View File

@@ -496,6 +496,7 @@ def _get_cert_path_for_host(*, config: 'SimpleConfig', host: str) -> str:
class Interface(Logger):
def __init__(self, *, network: 'Network', server: ServerAddr):
assert isinstance(server, ServerAddr), f"expected ServerAddr, got {type(server)}"
self.ready = network.asyncio_loop.create_future()
self.got_disconnected = asyncio.Event()
self.server = server