From 0df3c64855e92a20fc3275be2d3890758e001bb4 Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 27 Jan 2020 19:03:13 +0100 Subject: [PATCH] core: fix unexpected messages in debug mode (fixes #809) --- core/src/trezor/wire/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/trezor/wire/__init__.py b/core/src/trezor/wire/__init__.py index 7462048ba9..b826ee0949 100644 --- a/core/src/trezor/wire/__init__.py +++ b/core/src/trezor/wire/__init__.py @@ -281,12 +281,16 @@ async def handle_session(iface: WireInterface, session_id: int) -> None: await req_reader.aopen() if __debug__: + try: + msg_type = messages.get_type(req_reader.type).__name__ + except KeyError: + msg_type = "%d - unknown message type" % req_reader.type log.debug( __name__, - "%s:%x receive: %s", + "%s:%x receive: <%s>", iface.iface_num(), session_id, - messages.get_type(req_reader.type), + msg_type, ) else: # We have a reader left over from earlier. We should process