1
0

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)
This commit is contained in:
SomberNight
2024-06-10 20:14:22 +00:00
parent a2d5e31838
commit f8180c898c

View File

@@ -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