electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit ee36ec992c7498faaea3ff389d548fc309b3e560
parent 9286deca5752354f1ef516b72e755f4ed330d319
Author: ThomasV <thomasv@electrum.org>
Date:   Mon,  4 Sep 2017 15:10:32 +0200

segwit: add purpose to derivation

Diffstat:
Mlib/base_wizard.py | 2+-
Mlib/keystore.py | 6++++--
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/base_wizard.py b/lib/base_wizard.py @@ -293,7 +293,7 @@ class BaseWizard(object): self.derivation_dialog(f) def create_keystore(self, seed, passphrase): - k = keystore.from_seed(seed, passphrase) + k = keystore.from_seed(seed, passphrase, self.wallet_type=='multisig') self.on_keystore(k) def on_bip44(self, seed, passphrase, derivation): diff --git a/lib/keystore.py b/lib/keystore.py @@ -685,7 +685,7 @@ def bip44_derivation(account_id, segwit=False): coin = 1 if bitcoin.TESTNET else 0 return "m/%d'/%d'/%d'" % (bip, coin, int(account_id)) -def from_seed(seed, passphrase): +def from_seed(seed, passphrase, is_multisig): t = seed_type(seed) if t == 'old': keystore = Old_KeyStore({}) @@ -695,7 +695,9 @@ def from_seed(seed, passphrase): keystore.add_seed(seed) keystore.passphrase = passphrase bip32_seed = Mnemonic.mnemonic_to_seed(seed, passphrase) - keystore.add_xprv_from_seed(bip32_seed, t, "m/") + purpose = 1 if is_multisig else 0 + der = "m/" if t == 'standard' else ("m/%d'/"%purpose) + keystore.add_xprv_from_seed(bip32_seed, t, der) else: raise BaseException(t) return keystore