diff --git a/lib/utilities/constants.dart b/lib/utilities/constants.dart index c6fe81d74..740e40c24 100644 --- a/lib/utilities/constants.dart +++ b/lib/utilities/constants.dart @@ -38,7 +38,7 @@ abstract class Constants { // Enable Logger.print statements static const bool disableLogger = false; - static const int currentHiveDbVersion = 3; + static const int currentHiveDbVersion = 4; static int satsPerCoin(Coin coin) { switch (coin) { diff --git a/lib/utilities/db_version_migration.dart b/lib/utilities/db_version_migration.dart index ae5190fc4..1320fab25 100644 --- a/lib/utilities/db_version_migration.dart +++ b/lib/utilities/db_version_migration.dart @@ -141,6 +141,7 @@ class DbVersionMigrator { // try to continue migrating return await migrate(2, secureStore: secureStore); + case 2: await Hive.openBox(DB.boxNamePrefs); final prefs = Prefs.instance; @@ -154,6 +155,20 @@ class DbVersionMigrator { boxName: DB.boxNameDBInfo, key: "hive_data_version", value: 3); return await migrate(3, secureStore: secureStore); + case 3: + // clear possible broken firo cache + await DB.instance.deleteBoxFromDisk( + boxName: DB.instance.boxNameSetCache(coin: Coin.firo)); + await DB.instance.deleteBoxFromDisk( + boxName: DB.instance.boxNameUsedSerialsCache(coin: Coin.firo)); + + // update version + await DB.instance.put( + boxName: DB.boxNameDBInfo, key: "hive_data_version", value: 4); + + // try to continue migrating + return await migrate(4, secureStore: secureStore); + default: // finally return return;