From 6c6bd44ee887c23b3743eb24d2e5ea989dc55a48 Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Tue, 24 Sep 2019 16:10:09 +0200 Subject: [PATCH 1/2] core/recovery: fix Info button when the threshold was reached (#566) --- core/src/apps/management/recovery_device/homescreen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/apps/management/recovery_device/homescreen.py b/core/src/apps/management/recovery_device/homescreen.py index 89b6c58e87..9f50483be1 100644 --- a/core/src/apps/management/recovery_device/homescreen.py +++ b/core/src/apps/management/recovery_device/homescreen.py @@ -227,7 +227,7 @@ async def _show_remaining_groups_and_shares(ctx: wire.Context) -> None: share = None for i, r in enumerate(shares_remaining): - if 0 < r < slip39.MAX_SHARE_COUNT: + if 0 <= r < slip39.MAX_SHARE_COUNT: m = storage.recovery_shares.fetch_group(i)[0] if not share: share = slip39.decode_mnemonic(m) From f53694c3fe8ad0b32805bce8bd50d20e3708f9de Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Tue, 24 Sep 2019 16:12:19 +0200 Subject: [PATCH 2/2] core/recovery: rename variable and add a comment in Info button --- .../apps/management/recovery_device/homescreen.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/src/apps/management/recovery_device/homescreen.py b/core/src/apps/management/recovery_device/homescreen.py index 9f50483be1..8ceaed0a3c 100644 --- a/core/src/apps/management/recovery_device/homescreen.py +++ b/core/src/apps/management/recovery_device/homescreen.py @@ -226,22 +226,22 @@ async def _show_remaining_groups_and_shares(ctx: wire.Context) -> None: first_entered_index = i share = None - for i, r in enumerate(shares_remaining): - if 0 <= r < slip39.MAX_SHARE_COUNT: - m = storage.recovery_shares.fetch_group(i)[0] + for index, remaining in enumerate(shares_remaining): + if 0 <= remaining < slip39.MAX_SHARE_COUNT: + m = storage.recovery_shares.fetch_group(index)[0] if not share: share = slip39.decode_mnemonic(m) identifier = m.split(" ")[0:3] - identifiers.append([r, identifier]) - elif r == slip39.MAX_SHARE_COUNT: + identifiers.append([remaining, identifier]) + elif remaining == slip39.MAX_SHARE_COUNT: # no shares yet identifier = storage.recovery_shares.fetch_group(first_entered_index)[ 0 ].split(" ")[0:2] try: # we only add the group (two words) identifier once - identifiers.index([r, identifier]) + identifiers.index([remaining, identifier]) except ValueError: - identifiers.append([r, identifier]) + identifiers.append([remaining, identifier]) return await layout.show_remaining_shares( ctx, identifiers, shares_remaining, share.group_threshold