tfix: load trustedcoin plugin for two-step wallet creation - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 3631c27ed7a23c91f5bbab95f0a5ab90b520f26f DIR parent d74f0c0947a847f8cdf2716bd8305e82953c69c5 HTML Author: ThomasV <thomasv@electrum.org> Date: Thu, 28 Feb 2019 13:11:00 +0100 fix: load trustedcoin plugin for two-step wallet creation Diffstat: M electrum/base_wizard.py | 1 + M electrum/gui/qt/installwizard.py | 2 +- M electrum/storage.py | 9 ++++++++- M electrum/wallet.py | 5 +---- 4 files changed, 11 insertions(+), 6 deletions(-) --- DIR diff --git a/electrum/base_wizard.py b/electrum/base_wizard.py t@@ -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): DIR diff --git a/electrum/gui/qt/installwizard.py b/electrum/gui/qt/installwizard.py t@@ -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) DIR diff --git a/electrum/storage.py b/electrum/storage.py t@@ -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 t@@ -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) DIR diff --git a/electrum/wallet.py b/electrum/wallet.py t@@ -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, t@@ -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