tFix root derivation changes for BIP44_Wallets - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit b120dd8849a922df9e44d525a8447165d18f9e5f DIR parent e5aa543707ad9791058899646829118fd9b2e7b3 HTML Author: Neil Booth <kyuupichan@gmail.com> Date: Mon, 11 Jan 2016 10:53:07 +0900 Fix root derivation changes for BIP44_Wallets Wallet keys use root_name Also typo xub -> xpub Diffstat: M lib/wallet.py | 9 ++++++--- M plugins/trezor/plugin.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) --- DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -1727,9 +1727,10 @@ class BIP32_HD_Wallet(BIP32_RD_Wallet): derivation = self.account_derivation(account_id) root_name = self.root_derivation.split('/')[0] # NOT self.root_name! xpub, xprv = self.derive_xkeys(root_name, derivation, password) - self.add_master_public_key(derivation, xpub) + wallet_key = self.root_name + account_id + "'" + self.add_master_public_key(wallet_key, xpub) if xprv: - self.add_master_private_key(derivation, xprv, password) + self.add_master_private_key(wallet_key, xprv, password) account = BIP32_Account({'xpub':xpub}) self.add_account(account_id, account) if label: t@@ -1774,6 +1775,8 @@ class BIP44_Wallet(BIP32_HD_Wallet): digestmodule = hashlib.sha512).read(64) def derive_xkeys(self, root, derivation, password): + root = self.root_name + derivation = derivation.replace(self.root_derivation, root) x = self.master_private_keys.get(root) if x: root_xprv = pw_decode(x, password) t@@ -1781,7 +1784,7 @@ class BIP44_Wallet(BIP32_HD_Wallet): return xpub, xprv else: root_xpub = self.master_public_keys.get(root) - xpub = bip32_public_derivation(root_xub, root, derivation) + xpub = bip32_public_derivation(root_xpub, root, derivation) return xpub, None DIR diff --git a/plugins/trezor/plugin.py b/plugins/trezor/plugin.py t@@ -95,7 +95,7 @@ class TrezorCompatibleWallet(BIP44_Wallet): return (account.first_address()[0] if account else None, derivation) def derive_xkeys(self, root, derivation, password): - if self.master_public_keys.get(root): + if self.master_public_keys.get(self.root_name): return BIP44_wallet.derive_xkeys(self, root, derivation, password) # When creating a wallet we need to ask the device for the