From 9f9bab6cf03ec10a8fd99292cabe6f2328111809 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Wed, 31 Dec 2014 19:21:54 +0100 Subject: [PATCH] fix issue #968 --- gui/qt/__init__.py | 7 ++++++- gui/qt/installwizard.py | 8 +------- lib/wallet.py | 2 ++ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gui/qt/__init__.py b/gui/qt/__init__.py index d5d2b061d..ea1f6b789 100644 --- a/gui/qt/__init__.py +++ b/gui/qt/__init__.py @@ -163,7 +163,12 @@ class ElectrumGui: if action is not None: import installwizard wizard = installwizard.InstallWizard(self.config, self.network, storage) - wallet = wizard.run(action) + try: + wallet = wizard.run(action) + except BaseException as e: + traceback.print_exc(file=sys.stdout) + QMessageBox.information(None, _('Error'), str(e), _('OK')) + return if not wallet: return else: diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py index 85259684e..46f954ae1 100644 --- a/gui/qt/installwizard.py +++ b/gui/qt/installwizard.py @@ -389,13 +389,7 @@ class InstallWizard(QDialog): wallet.add_master_public_key("x3/", xpub3) elif action == 'create_accounts': - try: - wallet.create_main_account(password) - except BaseException as e: - import traceback - traceback.print_exc(file=sys.stdout) - QMessageBox.information(None, _('Error'), str(e), _('OK')) - return + wallet.create_main_account(password) self.waiting_dialog(wallet.synchronize) else: diff --git a/lib/wallet.py b/lib/wallet.py index cea0a2e0a..fe3128c62 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -1296,6 +1296,8 @@ class BIP32_Wallet(Deterministic_Wallet): raise InvalidPassword() def add_master_public_key(self, name, xpub): + if xpub in self.master_public_keys.values(): + raise BaseException('Duplicate master public key') self.master_public_keys[name] = xpub self.storage.put('master_public_keys', self.master_public_keys, True)