def on_edit(self): from electroncash.bitcoin import seed_type s = self.get_seed() b = self.is_seed(s) if not self.is_bip39: t = seed_type(s) label = _('Seed Type') + ': ' + t if t else '' else: from electroncash.keystore import bip39_is_checksum_valid is_checksum, is_wordlist = bip39_is_checksum_valid(s) status = ('checksum: ' + ('ok' if is_checksum else 'failed')) if is_wordlist else 'unknown wordlist' label = 'BIP39' + ' (%s)'%status self.seed_type_label.setText(label) self.parent.next_button.setEnabled(b)
def _slp_custom_chk(s, is_seed): from electroncash.bitcoin import seed_type from electroncash.keystore import bip39_is_checksum_valid is_checksum, is_wordlist = bip39_is_checksum_valid(s) if not is_seed: return '', 'no seed', False, False, False if not is_wordlist: return '', 'unknown wordlist', is_checksum, is_wordlist, False else: if is_checksum: return 'BIP39', 'checksum: ok', is_checksum, is_wordlist, False else: try: st = seed_type(s) if st in ('old', 'standard'): return 'Electron Cash regular seed', 'not SLP', is_checksum, is_wordlist, True except: # seed_type may raise i think pass return 'BIP39', 'checksum: failed', is_checksum, is_wordlist, False