tadd_cosigner_seed - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 91723999aad87509277ddbdbd498042935e34624 DIR parent 0ce463c99c75c4238a1e806a51ad1025e21300f7 HTML Author: ThomasV <thomasv@gitorious> Date: Fri, 22 Aug 2014 17:22:08 +0200 add_cosigner_seed Diffstat: M gui/qt/installwizard.py | 56 ++++++++++++++++++------------- M lib/wallet.py | 8 ++++++++ 2 files changed, 41 insertions(+), 23 deletions(-) --- DIR diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py t@@ -501,20 +501,20 @@ class InstallWizard(QDialog): else: password = None + if Wallet.is_seed(text2) and Wallet.is_xpub(text1): + c = text1 + text1 = text2 + text2 = c + if Wallet.is_seed(text1): wallet.add_seed(text1, password) - if Wallet.is_seed(text2): - wallet.add_cold_seed(text2, password) - else: - wallet.add_master_public_key("x2/", text2) else: - assert Wallet.is_xpub(text1) - if Wallet.is_seed(text2): - wallet.add_seed(text2, password) - wallet.add_master_public_key("x2/", text1) - else: - wallet.add_master_public_key("x1/", text1) - wallet.add_master_public_key("x2/", text2) + wallet.add_master_public_key("x1/", text1) + + if Wallet.is_seed(text2): + wallet.add_cosigner_seed(text2, "x2/", password) + elif Wallet.is_xpub(text2): + wallet.add_master_public_key("x2/", text2) wallet.create_main_account(password) t@@ -530,20 +530,30 @@ class InstallWizard(QDialog): else: password = None + if Wallet.is_xpub(text1) and Wallet.is_seed(text2): + temp = text1 + text1 = text2 + text2 = temp + + if Wallet.is_xpub(text1) and Wallet.is_seed(text3): + temp = text1 + text1 = text3 + text3 = temp + if Wallet.is_seed(text1): wallet.add_seed(text1, password) - if Wallet.is_seed(text2): - wallet.add_cold_seed(text2, password) - else: - wallet.add_master_public_key("x2/", text2) - - elif Wallet.is_xpub(text1): - if Wallet.is_seed(text2): - wallet.add_seed(text2, password) - wallet.add_master_public_key("x2/", text1) - else: - wallet.add_master_public_key("x1/", text1) - wallet.add_master_public_key("x2/", text2) + else: + wallet.add_master_public_key("x1/", text1) + + if Wallet.is_seed(text2): + wallet.add_cosigner_seed(text2, "x2/", password) + elif Wallet.is_xpub(text2): + wallet.add_master_public_key("x2/", text2) + + if Wallet.is_seed(text3): + wallet.add_cosigner_seed(text3, "x3/", password) + elif Wallet.is_xpub(text3): + wallet.add_master_public_key("x3/", text2) wallet.create_main_account(password) DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -1457,6 +1457,14 @@ class Wallet_2of2(BIP39_Wallet): if not self.accounts: return 'create_accounts' + def add_cosigner_seed(self, seed, name, password): + # we don't store the seed, only the master xpriv + xprv, xpub = bip32_root(seed) + xprv, xpub = bip32_private_derivation(xprv, "m/", self.root_derivation) + self.add_master_public_key(name, xpub) + self.add_master_private_key(name, xprv, password) + + class Wallet_2of3(Wallet_2of2): # multisig 2 of 3