From 482d573f5547c9805793b1720d27e99f8720498b Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 15 Jul 2025 13:23:50 +0000 Subject: [PATCH] stdio gui: use daemon.load_wallet(), similar to text gui --- electrum/gui/stdio.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/electrum/gui/stdio.py b/electrum/gui/stdio.py index 9d5794f35..34eab29c3 100644 --- a/electrum/gui/stdio.py +++ b/electrum/gui/stdio.py @@ -27,14 +27,16 @@ class ElectrumGui(BaseElectrumGui, EventListener): BaseElectrumGui.__init__(self, config=config, daemon=daemon, plugins=plugins) self.network = daemon.network storage = WalletStorage(config.get_wallet_path()) + password = None if not storage.file_exists(): print("Wallet not found. try 'electrum create'") exit() if storage.is_encrypted(): password = getpass.getpass('Password:', stream=None) storage.decrypt(password) - - db = WalletDB(storage.read(), storage=storage, upgrade=True) + del storage + self.wallet = self.daemon.load_wallet(config.get_wallet_path(), password) + self.contacts = self.wallet.contacts self.done = 0 self.last_balance = "" @@ -44,10 +46,6 @@ class ElectrumGui(BaseElectrumGui, EventListener): self.str_amount = "" self.str_fee = "" - self.wallet = Wallet(db, config=config) # type: Optional[Abstract_Wallet] - self.wallet.start_network(self.network) - self.contacts = self.wallet.contacts - self.register_callbacks() self.commands = [_("[h] - displays this help text"), \ _("[i] - display transaction history"), \ @@ -128,7 +126,8 @@ class ElectrumGui(BaseElectrumGui, EventListener): print(self.get_balance()) def get_balance(self): - if self.wallet.network.is_connected(): + network = self.wallet.network + if network and network.is_connected(): if not self.wallet.is_up_to_date(): msg = _("Synchronizing...") else: