diff options
author | Dan Finlay <dan@danfinlay.com> | 2018-06-07 07:46:39 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2018-06-07 07:46:39 +0800 |
commit | c53c5d5c9e2a384c6b0a17b844919f9fff9f960e (patch) | |
tree | 6aceb8b7ef83a573776fceadbc65300815ace182 /app | |
parent | aea9491f6a7888bd15a9d3dd7858bcda16f1e532 (diff) | |
download | tangerine-wallet-browser-c53c5d5c9e2a384c6b0a17b844919f9fff9f960e.tar tangerine-wallet-browser-c53c5d5c9e2a384c6b0a17b844919f9fff9f960e.tar.gz tangerine-wallet-browser-c53c5d5c9e2a384c6b0a17b844919f9fff9f960e.tar.bz2 tangerine-wallet-browser-c53c5d5c9e2a384c6b0a17b844919f9fff9f960e.tar.lz tangerine-wallet-browser-c53c5d5c9e2a384c6b0a17b844919f9fff9f960e.tar.xz tangerine-wallet-browser-c53c5d5c9e2a384c6b0a17b844919f9fff9f960e.tar.zst tangerine-wallet-browser-c53c5d5c9e2a384c6b0a17b844919f9fff9f960e.zip |
Fix bug where reset account would not work.
Fixes #4462
Ensures that resetAccount() can work on non-stock providers.
I'm unclear how this was ever working, this code hasn't moved in months,
but users report it recently breaking. Maybe we only recently pushed it
to prod.
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/controllers/network/network.js | 11 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 5 |
2 files changed, 10 insertions, 6 deletions
diff --git a/app/scripts/controllers/network/network.js b/app/scripts/controllers/network/network.js index 93fde7c57..5e0c63e7d 100644 --- a/app/scripts/controllers/network/network.js +++ b/app/scripts/controllers/network/network.js @@ -89,14 +89,21 @@ module.exports = class NetworkController extends EventEmitter { type: 'rpc', rpcTarget, } - this.providerStore.updateState(providerConfig) - this._switchNetwork(providerConfig) + this.providerConfig = providerConfig } async setProviderType (type) { assert.notEqual(type, 'rpc', `NetworkController - cannot call "setProviderType" with type 'rpc'. use "setRpcTarget"`) assert(INFURA_PROVIDER_TYPES.includes(type) || type === LOCALHOST, `NetworkController - Unknown rpc type "${type}"`) const providerConfig = { type } + this.providerConfig = providerConfig + } + + resetConnection () { + this.providerConfig = this.getProviderConfig() + } + + set providerConfig (providerConfig) { this.providerStore.updateState(providerConfig) this._switchNetwork(providerConfig) } diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 1bb0af5ee..873ba7995 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -628,10 +628,7 @@ module.exports = class MetamaskController extends EventEmitter { async resetAccount () { const selectedAddress = this.preferencesController.getSelectedAddress() this.txController.wipeTransactions(selectedAddress) - - const networkController = this.networkController - const oldType = networkController.getProviderConfig().type - await networkController.setProviderType(oldType, true) + this.networkController.resetConnection() return selectedAddress } |