URI: 
       tcheck xkey type when we add the keystore, so that we cover all cases - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit f0fe84d959d16c090cfd793efebf6af7d2d06a04
   DIR parent 123c5e31657f7990c235a00ee8ba0982e92b1509
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Thu, 14 Sep 2017 14:38:19 +0200
       
       check xkey type when we add the keystore, so that we cover all cases
       
       Diffstat:
         M lib/base_wizard.py                  |      17 +++++++++--------
         M lib/bitcoin.py                      |       3 +++
       
       2 files changed, 12 insertions(+), 8 deletions(-)
       ---
   DIR diff --git a/lib/base_wizard.py b/lib/base_wizard.py
       t@@ -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)
       t@@ -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()
   DIR diff --git a/lib/bitcoin.py b/lib/bitcoin.py
       t@@ -869,6 +869,9 @@ def deserialize_xpub(xkey):
        def deserialize_xprv(xkey):
            return deserialize_xkey(xkey, True)
        
       +def xpub_type(x):
       +    return deserialize_xpub(x)[0]
       +
        
        def is_xpub(text):
            try: