1
0

use daemon.load_wallet instead of constructing manually

This commit is contained in:
f321x
2025-05-12 10:53:12 +02:00
parent 6e21dac387
commit 5bfddad67c

View File

@@ -63,15 +63,14 @@ class ElectrumGui(BaseElectrumGui, EventListener):
BaseElectrumGui.__init__(self, config=config, daemon=daemon, plugins=plugins) BaseElectrumGui.__init__(self, config=config, daemon=daemon, plugins=plugins)
self.network = daemon.network self.network = daemon.network
storage = WalletStorage(config.get_wallet_path(use_gui_last_wallet=True)) storage = WalletStorage(config.get_wallet_path(use_gui_last_wallet=True))
password = None
if not storage.file_exists(): if not storage.file_exists():
print("Wallet not found. try 'electrum create'") print("Wallet not found. try 'electrum create'")
exit() exit()
if storage.is_encrypted(): if storage.is_encrypted():
password = getpass.getpass('Password:', stream=None) password = getpass.getpass('Password:', stream=None)
storage.decrypt(password) del storage
db = WalletDB(storage.read(), storage=storage, upgrade=True) self.wallet = self.daemon.load_wallet(config.get_wallet_path(use_gui_last_wallet=True), password)
self.wallet = Wallet(db, config=config) # type: Optional[Abstract_Wallet]
self.wallet.start_network(self.network)
self.contacts = self.wallet.contacts self.contacts = self.wallet.contacts
locale.setlocale(locale.LC_ALL, '') locale.setlocale(locale.LC_ALL, '')