qt wizard: WCHaveMasterKey: use check_multisig_constraints
These checks were missing from validation. e.g. duplicate master keys were allowed.
This commit is contained in:
@@ -831,20 +831,26 @@ class WCHaveMasterKey(WizardComponent):
|
|||||||
# self.add_cosigner_dialog(index=i, run_next=self.on_restore_from_key, is_valid=keystore.is_bip32_key)
|
# self.add_cosigner_dialog(index=i, run_next=self.on_restore_from_key, is_valid=keystore.is_bip32_key)
|
||||||
if self.wizard_data['wallet_type'] == 'standard':
|
if self.wizard_data['wallet_type'] == 'standard':
|
||||||
self.label.setText(self.message_create)
|
self.label.setText(self.message_create)
|
||||||
v = lambda x: bool(keystore.from_master_key(x))
|
is_valid = lambda x: bool(keystore.from_master_key(x))
|
||||||
self.slayout = KeysLayout(parent=self, header_layout=self.header_layout, is_valid=v,
|
|
||||||
allow_multi=False, config=self.wizard.config)
|
|
||||||
self.layout().addLayout(self.slayout)
|
|
||||||
elif self.wizard_data['wallet_type'] == 'multisig':
|
elif self.wizard_data['wallet_type'] == 'multisig':
|
||||||
if 'multisig_current_cosigner' in self.wizard_data:
|
if 'multisig_current_cosigner' in self.wizard_data:
|
||||||
self.title = _("Add Cosigner {}").format(self.wizard_data['multisig_current_cosigner'])
|
self.title = _("Add Cosigner {}").format(self.wizard_data['multisig_current_cosigner'])
|
||||||
self.label.setText(self.message_cosign)
|
self.label.setText(self.message_cosign)
|
||||||
else:
|
else:
|
||||||
self.label.setText(self.message_create)
|
self.label.setText(self.message_create)
|
||||||
v = lambda x: keystore.is_bip32_key(x)
|
def is_valid(x) -> bool:
|
||||||
self.slayout = KeysLayout(parent=self, header_layout=self.header_layout, is_valid=v,
|
if not keystore.is_bip32_key(x):
|
||||||
allow_multi=False, config=self.wizard.config)
|
return False
|
||||||
self.layout().addLayout(self.slayout)
|
self.apply()
|
||||||
|
if not self.wizard.check_multisig_constraints(self.wizard_data)[0]:
|
||||||
|
# TODO: user feedback
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
raise Exception(f"unexpected wallet type: {self.wizard_data['wallet_type']}")
|
||||||
|
self.slayout = KeysLayout(parent=self, header_layout=self.header_layout, is_valid=is_valid,
|
||||||
|
allow_multi=False, config=self.wizard.config)
|
||||||
|
self.layout().addLayout(self.slayout)
|
||||||
|
|
||||||
def apply(self):
|
def apply(self):
|
||||||
text = self.slayout.get_text()
|
text = self.slayout.get_text()
|
||||||
|
|||||||
Reference in New Issue
Block a user