commit 2239cb9624373b2a38f132cdeb42a75ecbc3924b
parent 4c2269844481e95d19dbd00bac9e994ea2eeb6c4
Author: ThomasV <thomasv@electrum.org>
Date: Sun, 24 Sep 2017 10:18:08 +0200
fix #2921
Diffstat:
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/lib/bitcoin.py b/lib/bitcoin.py
@@ -973,9 +973,3 @@ def bip32_private_key(sequence, k, chain):
k, chain = CKD_priv(k, chain, i)
return SecretToASecret(k, True)
-
-def xkeys_from_seed(seed, passphrase, derivation):
- from .mnemonic import Mnemonic
- xprv, xpub = bip32_root(Mnemonic.mnemonic_to_seed(seed, passphrase), 0)
- xprv, xpub = bip32_private_derivation(xprv, "m/", derivation)
- return xprv, xpub
diff --git a/plugins/trustedcoin/trustedcoin.py b/plugins/trustedcoin/trustedcoin.py
@@ -385,17 +385,25 @@ class TrustedCoinPlugin(BasePlugin):
f = lambda x: wizard.request_passphrase(seed, x)
wizard.show_seed_dialog(run_next=f, seed_text=seed)
+ def get_xkeys(self, seed, passphrase, derivation):
+ from electrum.mnemonic import Mnemonic
+ from electrum.keystore import bip32_root, bip32_private_derivation
+ bip32_seed = Mnemonic.mnemonic_to_seed(seed, passphrase)
+ xprv, xpub = bip32_root(bip32_seed, 'standard')
+ xprv, xpub = bip32_private_derivation(xprv, "m/", derivation)
+ return xprv, xpub
+
def xkeys_from_seed(self, seed, passphrase):
words = seed.split()
n = len(words)
# old version use long seed phrases
if n >= 24:
assert passphrase == ''
- xprv1, xpub1 = keystore.xkeys_from_seed(' '.join(words[0:12]), '', "m/")
- xprv2, xpub2 = keystore.xkeys_from_seed(' '.join(words[12:]), '', "m/")
+ xprv1, xpub1 = self.get_xkeys(' '.join(words[0:12]), '', "m/")
+ xprv2, xpub2 = self.get_xkeys(' '.join(words[12:]), '', "m/")
elif n==12:
- xprv1, xpub1 = keystore.xkeys_from_seed(seed, passphrase, "m/0'/")
- xprv2, xpub2 = keystore.xkeys_from_seed(seed, passphrase, "m/1'/")
+ xprv1, xpub1 = self.get_xkeys(seed, passphrase, "m/0'/")
+ xprv2, xpub2 = self.get_xkeys(seed, passphrase, "m/1'/")
else:
raise BaseException('unrecognized seed length')
return xprv1, xpub1, xprv2, xpub2