diff --git a/core/src/apps/management/recovery_device/homescreen.py b/core/src/apps/management/recovery_device/homescreen.py index 8ceaed0a3c..e82230ee8d 100644 --- a/core/src/apps/management/recovery_device/homescreen.py +++ b/core/src/apps/management/recovery_device/homescreen.py @@ -219,7 +219,7 @@ async def _show_remaining_groups_and_shares(ctx: wire.Context) -> None: """ shares_remaining = storage.recovery.fetch_slip39_remaining_shares() - identifiers = [] + groups = set() first_entered_index = -1 for i in range(len(shares_remaining)): if shares_remaining[i] < slip39.MAX_SHARE_COUNT: @@ -232,17 +232,13 @@ async def _show_remaining_groups_and_shares(ctx: wire.Context) -> None: if not share: share = slip39.decode_mnemonic(m) identifier = m.split(" ")[0:3] - identifiers.append([remaining, identifier]) + groups.add((remaining, tuple(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([remaining, identifier]) - except ValueError: - identifiers.append([remaining, identifier]) + groups.add((remaining, tuple(identifier))) return await layout.show_remaining_shares( - ctx, identifiers, shares_remaining, share.group_threshold + ctx, groups, shares_remaining, share.group_threshold ) diff --git a/core/src/apps/management/recovery_device/layout.py b/core/src/apps/management/recovery_device/layout.py index 67bfd583ba..fe061c1e4f 100644 --- a/core/src/apps/management/recovery_device/layout.py +++ b/core/src/apps/management/recovery_device/layout.py @@ -21,7 +21,7 @@ if __debug__: from apps.debug import input_signal if False: - from typing import List, Optional, Callable + from typing import List, Optional, Callable, Iterable, Tuple from trezor.messages.ResetDevice import EnumTypeBackupType @@ -152,7 +152,7 @@ async def check_word_validity( async def show_remaining_shares( ctx: wire.Context, - groups: List[int, List[str]], # remaining + list 3 words + groups: Iterable[Tuple[int, Tuple[str]]], # remaining + list 3 words shares_remaining: List[int], group_threshold: int, ) -> None: