diff --git a/core/src/main.py b/core/src/main.py index 55e312125e..c22847e6e4 100644 --- a/core/src/main.py +++ b/core/src/main.py @@ -71,13 +71,13 @@ def _boot_apps() -> None: from trezor import loop, wire, workflow -while True: - # initialize the wire codec - wire.setup(usb.iface_wire) - if __debug__: - wire.setup(usb.iface_debug) +# initialize the wire codec +wire.setup(usb.iface_wire) +if __debug__: + wire.setup(usb.iface_debug) - _boot_apps() - loop.run() +_boot_apps() +loop.run() - # loop is empty, reboot +# loop is empty. That should not happen +utils.halt("All tasks have died.") diff --git a/core/src/trezor/workflow.py b/core/src/trezor/workflow.py index aaecf4a463..9cc10fe1c0 100644 --- a/core/src/trezor/workflow.py +++ b/core/src/trezor/workflow.py @@ -104,11 +104,14 @@ def _finalize_default(task: loop.Task, value: Any) -> None: log.debug(__name__, "default closed: %s", task) default_task = None - if not tasks and default_constructor: + if not tasks: # No registered workflows are running and we are in the default task # finalizer, so when this function finished, nothing will be running. # We must schedule a new instance of the default now. - start_default(default_constructor) + if default_constructor is not None: + start_default(default_constructor) + else: + raise RuntimeError # no tasks and no default constructor else: if __debug__: