aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorDan Finlay <542863+danfinlay@users.noreply.github.com>2018-06-08 01:47:34 +0800
committerGitHub <noreply@github.com>2018-06-08 01:47:34 +0800
commitc0d2dab28b4083ee3ef65b6b561e28c811c6773d (patch)
tree2e7a481a7c160cb9b0f946400e6bc5c1d6aff354 /app/scripts
parent988283778a2be52640b27a359ef3fb1130e95711 (diff)
parentc53c5d5c9e2a384c6b0a17b844919f9fff9f960e (diff)
downloadtangerine-wallet-browser-c0d2dab28b4083ee3ef65b6b561e28c811c6773d.tar
tangerine-wallet-browser-c0d2dab28b4083ee3ef65b6b561e28c811c6773d.tar.gz
tangerine-wallet-browser-c0d2dab28b4083ee3ef65b6b561e28c811c6773d.tar.bz2
tangerine-wallet-browser-c0d2dab28b4083ee3ef65b6b561e28c811c6773d.tar.lz
tangerine-wallet-browser-c0d2dab28b4083ee3ef65b6b561e28c811c6773d.tar.xz
tangerine-wallet-browser-c0d2dab28b4083ee3ef65b6b561e28c811c6773d.tar.zst
tangerine-wallet-browser-c0d2dab28b4083ee3ef65b6b561e28c811c6773d.zip
Merge pull request #4523 from MetaMask/i4462-FixResetBug
Fix bug where reset account would not work.
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/controllers/network/network.js11
-rw-r--r--app/scripts/metamask-controller.js5
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 532cfbd61..a362e3826 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -630,10 +630,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
}