Browse Source

mnemonic: make_seed: add sanity-check

When going through the wizard, this case would previously have errored later in the flow. (for '2fa' at least)
master
SomberNight 2 years ago
parent
commit
f8180c898c
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 6
      electrum/mnemonic.py

6
electrum/mnemonic.py

@ -230,7 +230,11 @@ class Mnemonic(Logger):
continue
if is_new_seed(seed, prefix):
break
self.logger.info(f'{len(seed.split())} words')
num_words = len(seed.split())
self.logger.info(f'{num_words} words')
if (final_seed_type := calc_seed_type(seed)) != seed_type:
# note: I guess this can probabilistically happen for old "2fa" seeds that depend on the word count
raise Exception(f"{final_seed_type=!r} does not match requested {seed_type=!r}. have {num_words=!r}")
return seed

Loading…
Cancel
Save