aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorBruno <brunobar79@gmail.com>2018-06-13 13:55:35 +0800
committerBruno <brunobar79@gmail.com>2018-06-13 13:55:35 +0800
commitb6980eed87dcd3b3fcd8a901af0cf075d894d956 (patch)
treefb39d41db91c831202dc0b057231b77ed1308210 /app/scripts/metamask-controller.js
parent4e7d92ec8f360658c08f993256eeb121038c9dcf (diff)
parent73a9aaa8338c2d8a2960a79f02369caaa21b3c95 (diff)
downloadtangerine-wallet-browser-b6980eed87dcd3b3fcd8a901af0cf075d894d956.tar
tangerine-wallet-browser-b6980eed87dcd3b3fcd8a901af0cf075d894d956.tar.gz
tangerine-wallet-browser-b6980eed87dcd3b3fcd8a901af0cf075d894d956.tar.bz2
tangerine-wallet-browser-b6980eed87dcd3b3fcd8a901af0cf075d894d956.tar.lz
tangerine-wallet-browser-b6980eed87dcd3b3fcd8a901af0cf075d894d956.tar.xz
tangerine-wallet-browser-b6980eed87dcd3b3fcd8a901af0cf075d894d956.tar.zst
tangerine-wallet-browser-b6980eed87dcd3b3fcd8a901af0cf075d894d956.zip
Merge branch 'develop' of git://github.com/Metamask/metamask-extension into develop
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js20
1 files changed, 8 insertions, 12 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index a362e3826..e444180cc 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -436,28 +436,24 @@ module.exports = class MetamaskController extends EventEmitter {
* @returns {Object} vault
*/
async createNewVaultAndKeychain (password) {
- const release = await this.createVaultMutex.acquire()
- let vault
-
+ const releaseLock = await this.createVaultMutex.acquire()
try {
+ let vault
const accounts = await this.keyringController.getAccounts()
-
if (accounts.length > 0) {
vault = await this.keyringController.fullUpdate()
-
} else {
vault = await this.keyringController.createNewVaultAndKeychain(password)
const accounts = await this.keyringController.getAccounts()
this.preferencesController.setAddresses(accounts)
this.selectFirstIdentity()
}
- release()
+ releaseLock()
+ return vault
} catch (err) {
- release()
+ releaseLock()
throw err
}
-
- return vault
}
/**
@@ -466,7 +462,7 @@ module.exports = class MetamaskController extends EventEmitter {
* @param {} seed
*/
async createNewVaultAndRestore (password, seed) {
- const release = await this.createVaultMutex.acquire()
+ const releaseLock = await this.createVaultMutex.acquire()
try {
// clear known identities
this.preferencesController.setAddresses([])
@@ -476,10 +472,10 @@ module.exports = class MetamaskController extends EventEmitter {
const accounts = await this.keyringController.getAccounts()
this.preferencesController.setAddresses(accounts)
this.selectFirstIdentity()
- release()
+ releaseLock()
return vault
} catch (err) {
- release()
+ releaseLock()
throw err
}
}