Browse Source

add_cosigner_seed

283
ThomasV 11 years ago
parent
commit
91723999aa
  1. 44
      gui/qt/installwizard.py
  2. 8
      lib/wallet.py

44
gui/qt/installwizard.py

@ -501,19 +501,19 @@ 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)
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,21 +530,31 @@ 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)
wallet.add_master_public_key("x1/", text1)
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_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)
else:

8
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

Loading…
Cancel
Save