mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix dual vault creation bug
This commit is contained in:
parent
ed1917d71a
commit
185396ff08
@ -131,12 +131,10 @@ module.exports = class KeyringController extends EventEmitter {
|
|||||||
const keyring = this.restoreKeyring(accountLength, serialized)
|
const keyring = this.restoreKeyring(accountLength, serialized)
|
||||||
this.keyrings.push(keyring)
|
this.keyrings.push(keyring)
|
||||||
this.configManager.setSelectedAccount(keyring.getAccounts()[0])
|
this.configManager.setSelectedAccount(keyring.getAccounts()[0])
|
||||||
return this.persistAllKeyrings().then(() => {
|
|
||||||
return key
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
return Promise.resolve(key)
|
|
||||||
}
|
}
|
||||||
|
return this.persistAllKeyrings().then(() => {
|
||||||
|
return key
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,12 +145,7 @@ module.exports = class KeyringController extends EventEmitter {
|
|||||||
|
|
||||||
return this.migrateAndGetKey(password)
|
return this.migrateAndGetKey(password)
|
||||||
.then((key) => {
|
.then((key) => {
|
||||||
return new Promise((res, rej) => {
|
cb(null, configManager.getVault())
|
||||||
this.createFirstKeyTree(password, (err, state) => {
|
|
||||||
if (err) return rej(err)
|
|
||||||
res(configManager.getVault())
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.then((encryptedString) => {
|
.then((encryptedString) => {
|
||||||
const serialized = this.keyrings[0].serialize()
|
const serialized = this.keyrings[0].serialize()
|
||||||
|
@ -9,13 +9,24 @@ const sampleMnemonic = 'finish oppose decorate face calm tragic certain desk hou
|
|||||||
const firstAcct = '1c96099350f13d558464ec79b9be4445aa0ef579'
|
const firstAcct = '1c96099350f13d558464ec79b9be4445aa0ef579'
|
||||||
const secondAcct = '1b00aed43a693f3a957f9feb5cc08afa031e37a0'
|
const secondAcct = '1b00aed43a693f3a957f9feb5cc08afa031e37a0'
|
||||||
|
|
||||||
describe('simple-keyring', function() {
|
describe('hd-keyring', function() {
|
||||||
|
|
||||||
let keyring
|
let keyring
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
keyring = new HdKeyring()
|
keyring = new HdKeyring()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('constructor', function() {
|
||||||
|
keyring = new HdKeyring({
|
||||||
|
mnemonic: sampleMnemonic,
|
||||||
|
n: 2,
|
||||||
|
})
|
||||||
|
|
||||||
|
const accounts = keyring.getAccounts()
|
||||||
|
assert.equal(accounts[0], firstAcct)
|
||||||
|
assert.equal(accounts[1], secondAcct)
|
||||||
|
})
|
||||||
|
|
||||||
describe('Keyring.type()', function() {
|
describe('Keyring.type()', function() {
|
||||||
it('is a class method that returns the type string.', function() {
|
it('is a class method that returns the type string.', function() {
|
||||||
const type = HdKeyring.type()
|
const type = HdKeyring.type()
|
||||||
|
Loading…
Reference in New Issue
Block a user