From a5d7f2fe46c8702edd3953e914ff35a6c3f781db Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Thu, 27 Jun 2019 15:41:40 +0200 Subject: [PATCH] core/slip39: catch exception also when finding out threshold in recovery (cherry picked from commit 390bef00caace8a44ae053d2bb7c53b079983988) --- core/src/apps/management/recovery_device.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/apps/management/recovery_device.py b/core/src/apps/management/recovery_device.py index b25dafa2c..5a026b5e9 100644 --- a/core/src/apps/management/recovery_device.py +++ b/core/src/apps/management/recovery_device.py @@ -70,7 +70,10 @@ async def recovery_device(ctx, msg): ctx, wordcount, mnemonic_module == mnemonic.slip39 ) if mnemonic_threshold is None: - mnemonic_threshold = mnemonic_module.get_mnemonic_threshold(words) + try: + mnemonic_threshold = mnemonic_module.get_mnemonic_threshold(words) + except slip39.MnemonicError: + raise wire.ProcessError("Mnemonic is not valid") mnemonics.append(words) remaining = mnemonic_threshold - len(mnemonics) if remaining == 0: