diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 7eb291d89605..59b9d3720c24 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -3388,13 +3388,12 @@ export default class MetamaskController extends EventEmitter { await new Promise((resolve) => setTimeout(resolve, 5_000)); } - const { identities: oldIdentities } = - this.preferencesController.store.getState(); + const oldAccounts = await this.coreKeyringController.getAccounts(); const { addedAccountAddress } = await this.coreKeyringController.addNewAccount(accountCount); - if (Object.keys(oldIdentities).length === accountCount) { + if (!oldAccounts.includes(addedAccountAddress)) { this.preferencesController.setSelectedAddress(addedAccountAddress); }