From bca585d7151bed04d84f21d122134edaac1f060a Mon Sep 17 00:00:00 2001 From: grdddj Date: Mon, 23 Oct 2023 14:47:53 +0200 Subject: [PATCH] chore(emu): wipe storage when changing the model --- src/controller.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/controller.py b/src/controller.py index 2eac1b3..fd118fd 100644 --- a/src/controller.py +++ b/src/controller.py @@ -23,6 +23,7 @@ user="rpc", passwd="rpc", ) +PREV_RUNNING_MODEL: str = "" def is_regtest_active() -> bool: @@ -136,6 +137,8 @@ def run_bridge_command(self) -> dict: } def run_emulator_command(self) -> dict: + global PREV_RUNNING_MODEL + # The versions are sorted, the first one is the current master # build and then the rest by version number. # Not supplying any version will result in "2-master", @@ -158,6 +161,9 @@ def run_emulator_command(self) -> dict: wipe = self.request_dict.get("wipe", False) output_to_logfile = self.request_dict.get("output_to_logfile", True) save_screenshots = self.request_dict.get("save_screenshots", False) + if model != PREV_RUNNING_MODEL: + wipe = True + PREV_RUNNING_MODEL = model # type: ignore emulator.start( version=version, model=model, @@ -175,6 +181,9 @@ def run_emulator_command(self) -> dict: wipe = self.request_dict.get("wipe", False) output_to_logfile = self.request_dict.get("output_to_logfile", True) save_screenshots = self.request_dict.get("save_screenshots", False) + if model != PREV_RUNNING_MODEL: + wipe = True + PREV_RUNNING_MODEL = model # type: ignore emulator.start_from_url( url=url, model=model,