diff options
author | Frankie <frankie.diamond@gmail.com> | 2017-01-25 05:38:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-25 05:38:24 +0800 |
commit | 5811f2ab14f3a92eb8c92f20eb16a9b6dba35902 (patch) | |
tree | 6ed9ba41c99a37c3185ba1dd1c81e49d260c2f42 /app | |
parent | 247f7aad5e358fae33616fd310e695e06673dd19 (diff) | |
parent | 745fff0c80c49959aad9b0d214aff83cb05c3613 (diff) | |
download | tangerine-wallet-browser-5811f2ab14f3a92eb8c92f20eb16a9b6dba35902.tar tangerine-wallet-browser-5811f2ab14f3a92eb8c92f20eb16a9b6dba35902.tar.gz tangerine-wallet-browser-5811f2ab14f3a92eb8c92f20eb16a9b6dba35902.tar.bz2 tangerine-wallet-browser-5811f2ab14f3a92eb8c92f20eb16a9b6dba35902.tar.lz tangerine-wallet-browser-5811f2ab14f3a92eb8c92f20eb16a9b6dba35902.tar.xz tangerine-wallet-browser-5811f2ab14f3a92eb8c92f20eb16a9b6dba35902.tar.zst tangerine-wallet-browser-5811f2ab14f3a92eb8c92f20eb16a9b6dba35902.zip |
Merge pull request #1051 from MetaMask/hotfix1048
hotfix - addNewAccount - dont assume hd keyring position
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/keyring-controller.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index 86c93f5a3..76422bf6b 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -259,9 +259,11 @@ module.exports = class KeyringController extends EventEmitter { // Calls the `addAccounts` method on the Keyring // in the kryings array at index `keyringNum`, // and then saves those changes. - addNewAccount (keyRingNum = 0) { - const ring = this.keyrings[keyRingNum] - return ring.addAccounts(1) + addNewAccount () { + const hdKeyrings = this.keyrings.filter((keyring) => keyring.type === 'HD Key Tree') + const firstKeyring = hdKeyrings[0] + if (!firstKeyring) throw new Error('KeyringController - No HD Key Tree found') + return firstKeyring.addAccounts(1) .then(this.setupAccounts.bind(this)) .then(this.persistAllKeyrings.bind(this)) .then(this.fullUpdate.bind(this)) |