qml: multisig wizard check duplicate keys
This commit is contained in:
@@ -158,6 +158,7 @@ WizardComponent {
|
|||||||
id: extendcb
|
id: extendcb
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
text: qsTr('Extend seed with custom words')
|
text: qsTr('Extend seed with custom words')
|
||||||
|
onCheckedChanged: validationTimer.restart()
|
||||||
}
|
}
|
||||||
TextField {
|
TextField {
|
||||||
id: customwordstext
|
id: customwordstext
|
||||||
@@ -165,9 +166,7 @@ WizardComponent {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
placeholderText: qsTr('Enter your custom word(s)')
|
placeholderText: qsTr('Enter your custom word(s)')
|
||||||
onTextChanged: {
|
onTextChanged: validationTimer.restart()
|
||||||
validationTimer.restart()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,9 +262,36 @@ class NewWalletWizard(AbstractWizard):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def has_duplicate_keys(self, wizard_data):
|
def has_duplicate_keys(self, wizard_data):
|
||||||
# TODO
|
xpubs = []
|
||||||
|
xpubs.append(self.xpub_from_data(wizard_data))
|
||||||
|
for cosigner in wizard_data['multisig_cosigner_data']:
|
||||||
|
xpubs.append(self.xpub_from_data(wizard_data['multisig_cosigner_data'][cosigner]))
|
||||||
|
|
||||||
|
while len(xpubs):
|
||||||
|
xpub = xpubs.pop()
|
||||||
|
if xpub in xpubs:
|
||||||
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def xpub_from_data(self, data):
|
||||||
|
if 'seed' in data:
|
||||||
|
if data['seed_variant'] == 'electrum':
|
||||||
|
k = keystore.from_seed(data['seed'], data['seed_extra_words'], True)
|
||||||
|
elif data['seed_variant'] == 'bip39':
|
||||||
|
root_seed = keystore.bip39_to_seed(data['seed'], data['seed_extra_words'])
|
||||||
|
derivation = normalize_bip32_derivation(data['derivation_path'])
|
||||||
|
k = keystore.from_bip43_rootseed(root_seed, derivation, xtype='p2wsh')
|
||||||
|
else:
|
||||||
|
raise Exception('Unsupported seed variant %s' % data['seed_variant'])
|
||||||
|
|
||||||
|
return k.get_master_public_key()
|
||||||
|
elif 'master_key' in data:
|
||||||
|
k = keystore.from_master_key(data['master_key'])
|
||||||
|
return k.get_master_public_key()
|
||||||
|
else:
|
||||||
|
raise Exception('no seed or master_key in data')
|
||||||
|
|
||||||
def finished(self, wizard_data):
|
def finished(self, wizard_data):
|
||||||
self._logger.debug('finished')
|
self._logger.debug('finished')
|
||||||
# override
|
# override
|
||||||
|
|||||||
Reference in New Issue
Block a user