1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix Account Selection

Do not select accounts on restore, only on creation and deliberate selection.

Fixes #2164
This commit is contained in:
Dan Finlay 2017-09-27 14:43:23 -07:00
parent 87458dae24
commit 96ebbde634
2 changed files with 7 additions and 3 deletions

View File

@ -22,7 +22,7 @@ class PreferencesController {
})
}
getSelectedAddress (_address) {
getSelectedAddress () {
return this.store.getState().selectedAddress
}

View File

@ -107,7 +107,6 @@ class KeyringController extends EventEmitter {
const firstAccount = accounts[0]
if (!firstAccount) throw new Error('KeyringController - First Account not found.')
const hexAccount = normalizeAddress(firstAccount)
this.emit('newAccount', hexAccount)
return this.setupAccounts(accounts)
})
.then(this.persistAllKeyrings.bind(this, password))
@ -207,6 +206,12 @@ class KeyringController extends EventEmitter {
// and then saves those changes.
addNewAccount (selectedKeyring) {
return selectedKeyring.addAccounts(1)
.then((accounts) => {
accounts.forEach((hexAccount) => {
this.emit('newAccount', hexAccount)
})
return accounts
})
.then(this.setupAccounts.bind(this))
.then(this.persistAllKeyrings.bind(this))
.then(this._updateMemStoreKeyrings.bind(this))
@ -325,7 +330,6 @@ class KeyringController extends EventEmitter {
const firstAccount = accounts[0]
if (!firstAccount) throw new Error('KeyringController - No account found on keychain.')
const hexAccount = normalizeAddress(firstAccount)
this.emit('newAccount', hexAccount)
this.emit('newVault', hexAccount)
return this.setupAccounts(accounts)
})