diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 3f46cd2fe..39d5d33f0 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -150,7 +150,7 @@ angular.module('copayApp.services') root.profile.setChecked(platformInfo.ua, credentials.walletId); return cb(null, root.bindWalletClient(client)); - }, 1); + }, skipKeyValidation ? 50 : 0); }; root.bindProfile = function(profile, cb) { @@ -164,6 +164,8 @@ angular.module('copayApp.services') var l = root.profile.credentials.length; var i = 0, totalBound = 0; + if (!l) return cb(); + lodash.each(root.profile.credentials, function(credentials) { root.bindWallet(credentials, function(err, bound) { i++; @@ -311,21 +313,23 @@ angular.module('copayApp.services') // Creates a wallet on BWC/BWS var doCreateWallet = function(opts, cb) { $log.debug('Creating Wallet:', opts); - seedWallet(opts, function(err, walletClient) { - if (err) return cb(err); + $timeout(function() { + seedWallet(opts, function(err, walletClient) { + if (err) return cb(err); - var name = opts.name || gettextCatalog.getString('Personal Wallet'); - var myName = opts.myName || gettextCatalog.getString('me'); + var name = opts.name || gettextCatalog.getString('Personal Wallet'); + var myName = opts.myName || gettextCatalog.getString('me'); - walletClient.createWallet(name, myName, opts.m, opts.n, { - network: opts.networkName, - singleAddress: opts.singleAddress, - walletPrivKey: opts.walletPrivKey, - }, function(err, secret) { - if (err) return bwsError.cb(err, gettext('Error creating wallet'), cb); - return cb(null, walletClient, secret); + walletClient.createWallet(name, myName, opts.m, opts.n, { + network: opts.networkName, + singleAddress: opts.singleAddress, + walletPrivKey: opts.walletPrivKey, + }, function(err, secret) { + if (err) return bwsError.cb(err, gettext('Error creating wallet'), cb); + return cb(null, walletClient, secret); + }); }); - }); + }, 5); }; // Creates the default Copay profile and its wallet @@ -634,7 +638,6 @@ angular.module('copayApp.services') var defaults = configService.getDefaults(); configService.get(function(err) { - root.createDefaultProfile(opts, function(err, p) { if (err) return cb(err); diff --git a/test/helpers.js b/test/helpers.js index b8adbfb58..001a164d3 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -221,7 +221,6 @@ mocks.init = function(fixtures, controllerName, opts, done) { done(); }); } else { - _profileService_.create({ noWallet: true }, function(err) {