1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Refresh computed balances controller when restoring vault

This commit is contained in:
Dan Finlay 2017-10-18 14:22:04 -07:00
parent ea79eca8eb
commit 9cc1e8a6d8
2 changed files with 6 additions and 1 deletions

View File

@ -25,6 +25,10 @@ class ComputedbalancesController {
} }
} }
forgetAllBalances () {
this.balances = {}
}
_initBalanceUpdating () { _initBalanceUpdating () {
const store = this.accountTracker.store.getState() const store = this.accountTracker.store.getState()
this.addAnyAccountsFromStore(store) this.addAnyAccountsFromStore(store)

View File

@ -473,7 +473,7 @@ module.exports = class MetamaskController extends EventEmitter {
} }
forgetOldAccounts () { forgetOldAccounts () {
const { accountTracker } = this const { accountTracker, balancesController } = this
let oldAccounts = [] let oldAccounts = []
try { try {
oldAccounts = Object.keys(accountTracker.store.getState().accounts) oldAccounts = Object.keys(accountTracker.store.getState().accounts)
@ -481,6 +481,7 @@ module.exports = class MetamaskController extends EventEmitter {
log.warn('Could not load old accounts to forget', e) log.warn('Could not load old accounts to forget', e)
} }
oldAccounts.forEach(addr => accountTracker.removeAccount(addr)) oldAccounts.forEach(addr => accountTracker.removeAccount(addr))
balancesController.forgetAllBalances()
} }
selectFirstIdentity (vault) { selectFirstIdentity (vault) {