1
0

daemon: refactor load_wallet to not just return None, but raise specific exceptions.

The following exceptions should be expected:
FileNotFoundError: given wallet path does not exist
StorageReadWriteError: given file is not readable/writable or containing folder is not writable
InvalidPassword: wallet requires a password but no password or an invalid password was given
WalletFileException: any internal wallet data issue. specific subclasses can be caught separately:
-  WalletRequiresSplit: wallet needs splitting (split_data passed in Exception)
-  WalletRequiresUpgrade: wallet needs upgrade, and no upgrade=True was passed to load_wallet
-  WalletUnfinished: wallet file contains an action and needs additional information to finalize. (WalletDB passed in exception)

Removed qml/qewalletdb.py

This patch also fixes load_wallet calls in electrum/scripts and adds a qml workaround for dialogs opening and closing so
fast that the dialog opened==true property change is missed (which we need to manage the dialog/page stack)
This commit is contained in:
Sander van Grieken
2023-10-10 16:57:44 +02:00
parent bfba0dba56
commit 7ca9b735d5
12 changed files with 85 additions and 247 deletions

View File

@@ -51,7 +51,7 @@ if not os.path.exists(wallet_path):
create_new_wallet(path=wallet_path, config=config)
# open wallet
wallet = daemon.load_wallet(wallet_path, password=None, manual_upgrades=False)
wallet = daemon.load_wallet(wallet_path, password=None, upgrade=True)
wallet.start_network(network)

View File

@@ -28,7 +28,7 @@ if not os.path.exists(wallet_path):
create_new_wallet(path=wallet_path, config=config)
# open wallet
wallet = daemon.load_wallet(wallet_path, password=None, manual_upgrades=False)
wallet = daemon.load_wallet(wallet_path, password=None, upgrade=True)
wallet.start_network(network)
# you can use ~CLI commands by accessing command_runner