mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
Merge pull request #603 from trezor/tsusanka/groups-info
Small refactor in Info dialog
This commit is contained in:
commit
a2fed79f7e
@ -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
|
||||
)
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user