diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-09-13 06:18:32 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-09-13 06:18:32 +0800 |
commit | c3d1404e72f4978db5b4522cb793ffd22653d9ff (patch) | |
tree | 3e8891623006b780bcec86e958b21048cbbb4e1a /app/scripts | |
parent | 784856532cd6c0ae09544b7dcd19755194fa9200 (diff) | |
download | tangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.tar tangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.tar.gz tangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.tar.bz2 tangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.tar.lz tangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.tar.xz tangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.tar.zst tangerine-wallet-browser-c3d1404e72f4978db5b4522cb793ffd22653d9ff.zip |
Fix clearing of account cache on vault restore
Diffstat (limited to 'app/scripts')
-rw-r--r-- | app/scripts/lib/idStore.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 0c5260ffd..e84e1aba0 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -51,6 +51,7 @@ IdentityStore.prototype.createNewVault = function (password, entropy, cb) { this.configManager.setData({}) } + this.purgeCache() this._createVault(password, null, entropy, (err) => { if (err) return cb(err) @@ -59,7 +60,6 @@ IdentityStore.prototype.createNewVault = function (password, entropy, cb) { this.configManager.setShowSeedWords(true) var seedWords = this._idmgmt.getSeed() - cb(null, seedWords) }) } @@ -72,6 +72,8 @@ IdentityStore.prototype.recoverSeed = function (cb) { } IdentityStore.prototype.recoverFromSeed = function (password, seed, cb) { + this.purgeCache() + this._createVault(password, seed, null, (err) => { if (err) return cb(err) @@ -500,8 +502,10 @@ IdentityStore.prototype._createIdMgmt = function (derivedKey) { } IdentityStore.prototype.purgeCache = function () { - this._getAddresses().forEach((address) => { - this._ethStore.del(ethUtil.addHexPrefix(address)) + this._currentState.identities = {} + var accounts = Object.keys(this._ethStore._currentState.accounts) + accounts.forEach((address) => { + this._ethStore.removeAccount(address) }) } |