Browse Source

load wallet plugin in Wallet factory, fix trustedcoin wizard on kivy

sqlite_db
ThomasV 6 years ago
parent
commit
cb9dcb8e26
  1. 6
      electrum/json_db.py
  2. 1
      electrum/plugins/trustedcoin/trustedcoin.py
  3. 5
      electrum/wallet.py

6
electrum/json_db.py

@ -31,7 +31,6 @@ from typing import Dict
from . import util, bitcoin
from .util import PrintError, profiler, WalletFileException, multisig_type, TxMinedInfo
from .plugin import plugin_loaders
from .keystore import bip44_derivation
from .transaction import Transaction
@ -105,11 +104,6 @@ class JsonDB(PrintError):
if not isinstance(self.data, dict):
raise WalletFileException("Malformed wallet file (not dict)")
# check here if I need to load a plugin
t = self.get('wallet_type')
l = plugin_loaders.get(t)
if l: l()
if not self.manual_upgrades:
if self.requires_split():
raise WalletFileException("This wallet has multiple accounts and must be split")

1
electrum/plugins/trustedcoin/trustedcoin.py

@ -629,6 +629,7 @@ class TrustedCoinPlugin(BasePlugin):
k3 = keystore.from_xpub(xpub3)
wizard.data['x3/'] = k3.dump()
wizard.pw_args = password, encrypt_storage, STO_EV_USER_PW
wizard.terminate()
def create_remote_key(self, email, wizard):
xpub1 = wizard.data['x1/']['xpub']

5
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
from .plugin import run_hook, plugin_loaders
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,
@ -1838,6 +1838,9 @@ 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

Loading…
Cancel
Save