Skip to content

Commit 435a26e

Browse files
committed
fixup! fix(core): avoid failing ButtonRequest handling at ContinueOnErrors
1 parent bc6da12 commit 435a26e

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

core/src/trezor/ui/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,7 @@ def put_button_request(self, msg: ButtonRequestMsg | None) -> bool:
331331
return False
332332

333333
br = ButtonRequest(code=msg[0], name=msg[1], pages=self.layout.page_count())
334-
self.button_request_handler.put(br)
335-
return True
334+
return self.button_request_handler.put(br)
336335

337336
def _paint(self) -> None:
338337
"""Paint the layout and ensure that homescreen cache is properly invalidated."""

core/src/trezor/wire/protocol_common.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def __init__(self, ctx: Context) -> None:
188188
# Used for detecting missing ButtonAck in debug builds.
189189
self.pending = False
190190

191-
def put(self, br: ButtonRequest) -> None:
191+
def put(self, br: ButtonRequest) -> bool:
192192
if __debug__:
193193
if self.pending:
194194
from . import FirmwareError
@@ -201,6 +201,7 @@ def put(self, br: ButtonRequest) -> None:
201201

202202
# in production, we don't want this to fail, hence replace=True
203203
self.box.put(br, replace=True)
204+
return True
204205

205206
async def br_task(self, ack_callback: AckCallback) -> None:
206207
assert self.is_done.is_empty()
@@ -254,14 +255,14 @@ def __init__(self, ctx: Context, msg: str) -> None:
254255
self.msg = msg
255256
self.ignore = False
256257

257-
def put(self, br: ButtonRequest) -> None:
258+
def put(self, br: ButtonRequest) -> bool:
258259
if self.ignore:
259260
# Stop handling ButtonRequests in case of unexpected error.
260261
if __debug__:
261262
log.debug(__name__, "ButtonRequest: skipped %s (%s)", br.code, br.name)
262-
return
263+
return False
263264

264-
super().put(br)
265+
return super().put(br)
265266

266267
async def join(self) -> None:
267268
if self.ignore:

0 commit comments

Comments
 (0)