From b725bad53853f32dfc23eaeb1a242f4a1a8df64f Mon Sep 17 00:00:00 2001 From: M1nd3r Date: Tue, 19 Nov 2024 18:14:45 +0100 Subject: [PATCH] feat(python): delete `channel_data.json` when clearing all channels [no changelog] --- python/src/trezorlib/transport/thp/channel_database.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/src/trezorlib/transport/thp/channel_database.py b/python/src/trezorlib/transport/thp/channel_database.py index e096b06ddc..100bf150b6 100644 --- a/python/src/trezorlib/transport/thp/channel_database.py +++ b/python/src/trezorlib/transport/thp/channel_database.py @@ -67,9 +67,13 @@ def ensure_file_exists() -> None: def clear_stored_channels() -> None: - LOG.debug("Clearing contents of %s - to empty list.", DATA_PATH) + LOG.debug("Clearing contents of %s", DATA_PATH) with open(DATA_PATH, "w") as f: json.dump([], f) + try: + os.remove(DATA_PATH) + except Exception as e: + LOG.exception("Failed to delete %s (%s)", DATA_PATH, str(type(e))) def read_all_channels() -> t.List: