mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Clear AccountTracker accounts and CachedBalances on createNewVaultAndRestore (#9023)
This commit is contained in:
parent
7b2218ac6e
commit
f02478e026
@ -65,6 +65,14 @@ export default class CachedBalancesController {
|
||||
return balancesToCache
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes cachedBalances
|
||||
*/
|
||||
|
||||
clearCachedBalances () {
|
||||
this.store.updateState({ cachedBalances: {} })
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up listeners and subscriptions which should trigger an update of cached balances. These updates will
|
||||
* happen when the current account changes. Which happens on block updates, as well as on network and account
|
||||
|
@ -151,6 +151,14 @@ export default class AccountTracker {
|
||||
this.store.updateState({ accounts })
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all addresses and associated balances
|
||||
*/
|
||||
|
||||
clearAccounts () {
|
||||
this.store.updateState({ accounts: {} })
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a block, updates this AccountTracker's currentBlockGasLimit, and then updates each local account's balance
|
||||
* via EthQuery
|
||||
|
@ -631,6 +631,12 @@ export default class MetamaskController extends EventEmitter {
|
||||
// clear permissions
|
||||
this.permissionsController.clearPermissions()
|
||||
|
||||
// clear accounts in accountTracker
|
||||
this.accountTracker.clearAccounts()
|
||||
|
||||
// clear cachedBalances
|
||||
this.cachedBalancesController.clearCachedBalances()
|
||||
|
||||
// clear unapproved transactions
|
||||
this.txController.txStateManager.clearUnapprovedTxs()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user