mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
db migrate to force firo cache clear
This commit is contained in:
parent
cf82374a0c
commit
c84ae8ff21
2 changed files with 16 additions and 1 deletions
|
@ -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) {
|
||||
|
|
|
@ -141,6 +141,7 @@ class DbVersionMigrator {
|
|||
|
||||
// try to continue migrating
|
||||
return await migrate(2, secureStore: secureStore);
|
||||
|
||||
case 2:
|
||||
await Hive.openBox<dynamic>(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<dynamic>(
|
||||
boxName: DB.boxNameDBInfo, key: "hive_data_version", value: 4);
|
||||
|
||||
// try to continue migrating
|
||||
return await migrate(4, secureStore: secureStore);
|
||||
|
||||
default:
|
||||
// finally return
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue