Fix bug where resetAccount does not clear network cache

Fixes #3439
This commit is contained in:
Dan Finlay 2018-03-27 18:07:51 -07:00
parent 246287ff1c
commit 729a473210
2 changed files with 41 additions and 34 deletions

View File

@ -2,6 +2,8 @@
## Current Master
- Fix bug where the "Reset account" feature would not clear the network cache.
## 4.4.0 Mon Mar 26 2018
- Internationalization: Taiwanese, Thai, Slovenian

View File

@ -365,7 +365,7 @@ module.exports = class MetamaskController extends EventEmitter {
placeSeedWords: this.placeSeedWords.bind(this),
verifySeedPhrase: nodeify(this.verifySeedPhrase, this),
clearSeedWordCache: this.clearSeedWordCache.bind(this),
resetAccount: this.resetAccount.bind(this),
resetAccount: nodeify(this.resetAccount, this),
importAccountWithStrategy: this.importAccountWithStrategy.bind(this),
// vault management
@ -583,10 +583,15 @@ module.exports = class MetamaskController extends EventEmitter {
/**
* ?
*/
resetAccount (cb) {
async resetAccount (cb) {
const selectedAddress = this.preferencesController.getSelectedAddress()
this.txController.wipeTransactions(selectedAddress)
cb(null, selectedAddress)
const networkController = this.networkController
const oldType = networkController.getProvoderConfig().type
await networkController.setProviderType(oldType, true)
return selectedAddress
}
/**