diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py index abab24f82..efbdb57eb 100644 --- a/gui/qt/installwizard.py +++ b/gui/qt/installwizard.py @@ -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) @@ -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) diff --git a/lib/wallet.py b/lib/wallet.py index 8f0614f99..09830457f 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -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