From 9d6f816b15fd6c224b3d07620f5eee246b070ce8 Mon Sep 17 00:00:00 2001 From: Saleem Rashid Date: Mon, 13 Mar 2017 19:23:29 +0000 Subject: [PATCH] Testnet: Use correct BIP44 derivation --- lib/base_wizard.py | 4 ++-- lib/keystore.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/base_wizard.py b/lib/base_wizard.py index ff2e07cd..221788ca 100644 --- a/lib/base_wizard.py +++ b/lib/base_wizard.py @@ -26,6 +26,7 @@ import os import bitcoin import keystore +from keystore import bip44_derivation from wallet import Wallet, Imported_Wallet, Standard_Wallet, Multisig_Wallet, wallet_types from i18n import _ from plugins import run_hook @@ -219,7 +220,6 @@ class BaseWizard(object): # This is partially compatible with BIP45; assumes index=0 self.on_hw_derivation(name, device_info, "m/45'/0") else: - from keystore import bip44_derivation f = lambda x: self.run('on_hw_derivation', name, device_info, bip44_derivation(int(x))) self.account_id_dialog(f) @@ -301,7 +301,7 @@ class BaseWizard(object): def on_bip44(self, seed, passphrase, account_id): k = keystore.BIP32_KeyStore({}) bip32_seed = keystore.bip39_to_seed(seed, passphrase) - derivation = "m/44'/0'/%d'"%account_id + derivation = bip44_derivation(account_id) k.add_xprv_from_seed(bip32_seed, 0, derivation) self.on_keystore(k) diff --git a/lib/keystore.py b/lib/keystore.py index c1d2cabd..a7a24d72 100644 --- a/lib/keystore.py +++ b/lib/keystore.py @@ -650,7 +650,10 @@ is_private_key = lambda x: is_xprv(x) or is_private_key_list(x) is_bip32_key = lambda x: is_xprv(x) or is_xpub(x) def bip44_derivation(account_id): - return "m/44'/0'/%d'"% int(account_id) + if TESTNET: + return "m/44'/1'/%d'"% int(account_id) + else: + return "m/44'/0'/%d'"% int(account_id) def from_seed(seed, passphrase): t = seed_type(seed)