commit 11bbe31ae342c1b578e598b1dbd003a8556690f4
parent a10e6b6436c10c35bdd3aa46418d0c94409837c5
Author: ThomasV <thomasv@electrum.org>
Date: Thu, 26 Oct 2017 17:43:41 +0200
wizard: check xpub types before adding keystore
Diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/base_wizard.py b/lib/base_wizard.py
@@ -307,17 +307,25 @@ class BaseWizard(object):
self.on_keystore(k)
def on_keystore(self, k):
+ from .bitcoin import xpub_type
+ t1 = xpub_type(k.xpub) #fixme: old wallets
if self.wallet_type == 'standard':
+ if t1 not in ['standard', 'p2wpkh', 'p2wpkh-p2sh']:
+ self.show_error(_('Wrong key type') + ' %s'%t1)
+ self.run('choose_keystore')
+ return
self.keystores.append(k)
self.run('create_wallet')
elif self.wallet_type == 'multisig':
+ if t1 not in ['standard', 'p2wsh', 'p2wsh-p2sh']:
+ self.show_error(_('Wrong key type') + ' %s'%t1)
+ self.run('choose_keystore')
+ return
if k.xpub in map(lambda x: x.xpub, self.keystores):
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))