Merge pull request #5127 from MetaMask/account-tracker-network-change

Bug Fix: Force AccountTracker to update balances on network change
feature/default_network_editable
kumavis 6 years ago committed by GitHub
commit c289baa17a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/scripts/metamask-controller.js

@ -129,6 +129,7 @@ module.exports = class MetamaskController extends EventEmitter {
provider: this.provider,
blockTracker: this.blockTracker,
})
// start and stop polling for balances based on activeControllerConnections
this.on('controllerConnectionChanged', (activeControllerConnections) => {
if (activeControllerConnections > 0) {
@ -138,6 +139,11 @@ module.exports = class MetamaskController extends EventEmitter {
}
})
// ensure accountTracker updates balances after network change
this.networkController.on('networkDidChange', () => {
this.accountTracker._updateAccounts()
})
// key mgmt
const additionalKeyrings = [TrezorKeyring, LedgerBridgeKeyring]
this.keyringController = new KeyringController({

Loading…
Cancel
Save