diff --git a/lib/wallet.py b/lib/wallet.py index a7929c1b..12c7feed 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -1746,6 +1746,7 @@ class BIP32_HD_Wallet(BIP32_Wallet): class BIP44_Wallet(BIP32_HD_Wallet): root_derivation = "m/44'/0'" wallet_type = 'bip44' + restore_wallet_class = BIP44_Wallet def can_sign_xpubkey(self, x_pubkey): xpub, sequence = BIP32_Account.parse_xpubkey(x_pubkey) diff --git a/plugins/ledger/ledger.py b/plugins/ledger/ledger.py index f2b52e32..17f1e8e6 100644 --- a/plugins/ledger/ledger.py +++ b/plugins/ledger/ledger.py @@ -30,17 +30,14 @@ except ImportError: BTCHIP = False -class BTChipWallet(BIP32_HD_Wallet): +class BTChipWallet(BIP44_Wallet): wallet_type = 'btchip' device = 'Ledger' - root_derivation = "m/44'/0'" - restore_wallet_class = BIP44_Wallet def __init__(self, storage): - BIP32_HD_Wallet.__init__(self, storage) + BIP44_Wallet.__init__(self, storage) self.transport = None self.client = None - self.mpk = None self.device_checked = False self.signing = False self.force_watching_only = False @@ -56,10 +53,6 @@ class BTChipWallet(BIP32_HD_Wallet): self.device_checked = False raise Exception(message) - def can_sign_xpubkey(self, x_pubkey): - xpub, sequence = BIP32_Account.parse_xpubkey(x_pubkey) - return xpub in self.master_public_keys.values() - def can_create_accounts(self): return False @@ -142,18 +135,11 @@ class BTChipWallet(BIP32_HD_Wallet): self.proper_device = False return self.client - def address_id(self, address): - account_id, (change, address_index) = self.get_address_index(address) - return "44'/0'/%s'/%d/%d" % (account_id, change, address_index) - def derive_xkeys(self, root, derivation, password): derivation = derivation.replace(self.root_name,"44'/0'/") xpub = self.get_public_key(derivation) return xpub, None - def get_private_key(self, address, password): - return [] - def get_public_key(self, bip32_path): # S-L-O-W - we don't handle the fingerprint directly, so compute it manually from the previous node # This only happens once so it's bearable @@ -185,21 +171,9 @@ class BTChipWallet(BIP32_HD_Wallet): return EncodeBase58Check(xpub) - def get_master_public_key(self): - try: - if not self.mpk: - self.mpk = self.get_public_key("44'/0'") - return self.mpk - except Exception, e: - self.give_error(e, True) - def i4b(self, x): return pack('>I', x) - def add_keypairs(self, tx, keypairs, password): - #do nothing - no priv keys available - pass - def decrypt_message(self, pubkey, message, password): self.give_error("Not supported") diff --git a/plugins/trezor/plugin.py b/plugins/trezor/plugin.py index cbbbbae4..7e7aa26a 100644 --- a/plugins/trezor/plugin.py +++ b/plugins/trezor/plugin.py @@ -32,8 +32,6 @@ class TrezorCompatibleWallet(BIP44_Wallet): # - DEVICE_IDS # - wallet_type - restore_wallet_class = BIP44_Wallet - def __init__(self, storage): BIP44_Wallet.__init__(self, storage) # After timeout seconds we clear the device session