From 123c5e31657f7990c235a00ee8ba0982e92b1509 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Thu, 14 Sep 2017 14:00:29 +0200 Subject: [PATCH] wizard: check seed_type before creating multisig --- lib/base_wizard.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/base_wizard.py b/lib/base_wizard.py index 8ee0965b..d8181091 100644 --- a/lib/base_wizard.py +++ b/lib/base_wizard.py @@ -160,9 +160,15 @@ class BaseWizard(object): ]) self.add_xpub_dialog(title=title, message=message, run_next=self.on_restore_from_key, is_valid=v) else: - v = keystore.is_bip32_key + 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=v) + self.add_cosigner_dialog(index=i, run_next=self.on_restore_from_key, is_valid=check_xkey_type) def on_restore_from_key(self, text): k = keystore.from_keys(text) @@ -348,9 +354,6 @@ class BaseWizard(object): def show_xpub_and_add_cosigners(self, xpub): self.show_xpub_dialog(xpub=xpub, run_next=lambda x: self.run('choose_keystore')) - def add_cosigners(self, password, i): - self.add_cosigner_dialog(run_next=lambda x: self.on_cosigner(x, password, i), index=i, is_valid=keystore.is_xpub) - def on_cosigner(self, text, password, i): k = keystore.from_keys(text, password) self.on_keystore(k)