Skip to content

Commit 45c29c9

Browse files
committed
refactor(core): show backup success after I/O-related errors
In case the host is unavailable, #6651 will stop sending ButtonRequests. This PR makes sure that `show_backup_success()` won't fail if there was an error during the backup process - so the success screen will be shown to the user. Currently THP debug builds fail with an assertion if the FW tries to write again before the previous write was ACKed, so this PR makes sure that after an error no ButtonRequest will be sent after #6651 is merged. Note: writing the secret to storage is not affected by this change (since it doesn't access the active context / button request handler). [no changelog]
1 parent 993dbad commit 45c29c9

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

core/src/apps/management/reset_device/__init__.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,10 @@ async def reset_device(msg: ResetDevice) -> Success:
124124
if perform_backup:
125125
perform_backup = await prompt_backup()
126126

127-
# generate and display backup information for the master secret
128-
if perform_backup:
129-
with continue_on_errors("Backup in progress"):
127+
# avoid failing backup process due to I/O-related errors
128+
with continue_on_errors("Backup in progress"):
129+
# generate and display backup information for the master secret
130+
if perform_backup:
130131
# choose backup handler (prompt the user if method is `None`)
131132
handler = await layout.choose_backup_handler(msg.backup_method)
132133
await backup_seed(
@@ -135,19 +136,19 @@ async def reset_device(msg: ResetDevice) -> Success:
135136
mnemonic_secret=secret,
136137
)
137138

138-
# write settings and master secret into storage
139-
if msg.label is not None:
140-
storage_device.set_label(msg.label)
141-
storage_device.set_passphrase_enabled(bool(msg.passphrase_protection))
142-
storage_device.store_mnemonic_secret(
143-
secret=secret, # for SLIP-39, this is the EMS
144-
needs_backup=not perform_backup,
145-
no_backup=bool(msg.no_backup),
146-
)
139+
# write settings and master secret into storage
140+
if msg.label is not None:
141+
storage_device.set_label(msg.label)
142+
storage_device.set_passphrase_enabled(bool(msg.passphrase_protection))
143+
storage_device.store_mnemonic_secret(
144+
secret=secret, # for SLIP-39, this is the EMS
145+
needs_backup=not perform_backup,
146+
no_backup=bool(msg.no_backup),
147+
)
147148

148-
# if we backed up the wallet, show success message
149-
if perform_backup:
150-
await layout.show_backup_success()
149+
# if we backed up the wallet, show success message
150+
if perform_backup:
151+
await layout.show_backup_success()
151152

152153
return Success(message="Initialized") # TODO: Why "Initialized?"
153154

0 commit comments

Comments
 (0)