Skip to content

Commit 1a1bd52

Browse files
authored
Migration v4 (#983)
* fix damaged wallet criteria * move migration 3 to 4 so it runs again * fix comment
1 parent 0e2c546 commit 1a1bd52

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

src/model/migrations.js

+18-5
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,30 @@ export default async function runMigrations() {
152152
};
153153

154154
migrations.push(v2);
155+
155156
/*
156157
*************** Migration v3 ******************
158+
* Not in use
159+
*/
160+
161+
const v3 = async () => {
162+
logger.sentry('Ignoring migration v3');
163+
return true;
164+
};
165+
166+
migrations.push(v3);
167+
168+
/*
169+
*************** Migration v4 ******************
157170
* This step makes sure there are no wallets marked as damaged
158171
* incorrectly by the keychain integrity checks
159172
*/
160-
const v3 = async () => {
161-
logger.sentry('Start migration v3');
173+
const v4 = async () => {
174+
logger.sentry('Start migration v4');
162175
const { wallets, selected } = store.getState().wallets;
163176

164177
if (!wallets) {
165-
logger.sentry('Complete migration v3 early');
178+
logger.sentry('Complete migration v4 early');
166179
return;
167180
}
168181

@@ -198,10 +211,10 @@ export default async function runMigrations() {
198211
}
199212
}
200213
}
201-
logger.sentry('Complete migration v3');
214+
logger.sentry('Complete migration v4');
202215
};
203216

204-
migrations.push(v3);
217+
migrations.push(v4);
205218

206219
logger.sentry(
207220
`Migrations: ready to run migrations starting on number ${currentVersion}`

src/redux/wallets.js

+13
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,19 @@ export const checkKeychainIntegrity = () => async (dispatch, getState) => {
274274
}
275275
}
276276

277+
// Handle race condition:
278+
// A wallet is NOT damaged if:
279+
// - it's not imported
280+
// - and hasn't been migrated yet
281+
// - and the old seedphrase is still there
282+
if (
283+
!wallet.imported &&
284+
!oldSeedPhraseMigratedKey &&
285+
hasOldSeedphraseKey
286+
) {
287+
healthyWallet = true;
288+
}
289+
277290
if (!healthyWallet) {
278291
logger.sentry(
279292
'[KeychainIntegrityCheck]: declaring wallet unhealthy...'

0 commit comments

Comments
 (0)