commit 3631c27ed7a23c91f5bbab95f0a5ab90b520f26f
parent d74f0c0947a847f8cdf2716bd8305e82953c69c5
Author: ThomasV <thomasv@electrum.org>
Date:   Thu, 28 Feb 2019 13:11:00 +0100
fix: load trustedcoin plugin for two-step wallet creation
Diffstat:
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/electrum/base_wizard.py b/electrum/base_wizard.py
@@ -566,6 +566,7 @@ class BaseWizard(object):
         for key, value in self.data.items():
             storage.put(key, value)
         storage.write()
+        storage.load_plugins()
         return storage
 
     def show_xpub_and_add_cosigners(self, xpub):
diff --git a/electrum/gui/qt/installwizard.py b/electrum/gui/qt/installwizard.py
@@ -317,7 +317,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
                     self.show_warning(_('The file was removed'))
                 return
             self.show()
-            self.data = storage.data
+            self.data = storage.db.data # FIXME
             self.run(action)
             for k, v in self.data.items():
                 storage.put(k, v)
diff --git a/electrum/storage.py b/electrum/storage.py
@@ -31,7 +31,7 @@ import zlib
 
 from . import ecc
 from .util import PrintError, profiler, InvalidPassword, WalletFileException, bfh, standardize_path
-from .plugin import run_hook
+from .plugin import run_hook, plugin_loaders
 
 from .json_db import JsonDB
 
@@ -68,6 +68,13 @@ class WalletStorage(PrintError):
             # avoid new wallets getting 'upgraded'
             self.db = DB_Class('', manual_upgrades=False)
 
+        self.load_plugins()
+
+    def load_plugins(self):
+        wallet_type = self.db.get('wallet_type')
+        if wallet_type in plugin_loaders:
+            plugin_loaders[wallet_type]()
+
     def put(self, key,value):
         self.db.put(key, value)
 
diff --git a/electrum/wallet.py b/electrum/wallet.py
@@ -54,7 +54,7 @@ from .util import multisig_type
 from .storage import STO_EV_PLAINTEXT, STO_EV_USER_PW, STO_EV_XPUB_PW, WalletStorage
 from . import transaction, bitcoin, coinchooser, paymentrequest, ecc, bip32
 from .transaction import Transaction, TxOutput, TxOutputHwInfo
-from .plugin import run_hook, plugin_loaders
+from .plugin import run_hook
 from .address_synchronizer import (AddressSynchronizer, TX_HEIGHT_LOCAL,
                                    TX_HEIGHT_UNCONF_PARENT, TX_HEIGHT_UNCONFIRMED)
 from .paymentrequest import (PR_PAID, PR_UNPAID, PR_UNKNOWN, PR_EXPIRED,
@@ -1829,9 +1829,6 @@ class Wallet(object):
 
     def __new__(self, storage):
         wallet_type = storage.get('wallet_type')
-        # check here if I need to load a plugin
-        if wallet_type in plugin_loaders:
-            plugin_loaders[wallet_type]()
         WalletClass = Wallet.wallet_class(wallet_type)
         wallet = WalletClass(storage)
         # Convert hardware wallets restored with older versions of