aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--app/scripts/controllers/network/network.js11
-rw-r--r--app/scripts/metamask-controller.js5
3 files changed, 12 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 19287f046..9fef15109 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
## Current Master
+- Fix bug where account reset did not work with custom RPC providers.
+
## 4.7.4 Tue Jun 05 2018
- Add diagnostic reporting for users with multiple HD keyrings
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
}