|
|
@ -160,15 +160,8 @@ class BaseWizard(object): |
|
|
|
]) |
|
|
|
self.add_xpub_dialog(title=title, message=message, run_next=self.on_restore_from_key, is_valid=v) |
|
|
|
else: |
|
|
|
def check_xkey_type(x): |
|
|
|
if keystore.is_xpub(x): |
|
|
|
return bitcoin.deserialize_xpub(x)[0] == self.seed_type |
|
|
|
elif keystore.is_xprv(x): |
|
|
|
return bitcoin.deserialize_xprv(x)[0] == self.seed_type |
|
|
|
else: |
|
|
|
return False |
|
|
|
i = len(self.keystores) + 1 |
|
|
|
self.add_cosigner_dialog(index=i, run_next=self.on_restore_from_key, is_valid=check_xkey_type) |
|
|
|
self.add_cosigner_dialog(index=i, run_next=self.on_restore_from_key, is_valid=keystore.is_bip32_key) |
|
|
|
|
|
|
|
def on_restore_from_key(self, text): |
|
|
|
k = keystore.from_keys(text) |
|
|
@ -317,6 +310,14 @@ class BaseWizard(object): |
|
|
|
self.show_error(_('Error: duplicate master public key')) |
|
|
|
self.run('choose_keystore') |
|
|
|
return |
|
|
|
from .bitcoin import xpub_type |
|
|
|
if len(self.keystores)>0: |
|
|
|
t1 = xpub_type(k.xpub) |
|
|
|
t2 = xpub_type(self.keystores[0].xpub) |
|
|
|
if t1 != t2: |
|
|
|
self.show_error(_('Cannot add this cosigner:') + '\n' + "Their key type is '%s', we are '%s'"%(t1, t2)) |
|
|
|
self.run('choose_keystore') |
|
|
|
return |
|
|
|
self.keystores.append(k) |
|
|
|
if len(self.keystores) == 1: |
|
|
|
xpub = k.get_master_public_key() |
|
|
|