store wallet first then bind

This commit is contained in:
Ivan Socolsky 2015-01-05 10:15:51 -03:00
commit e98253adf1

View file

@ -683,12 +683,14 @@ Identity.prototype.createWallet = function(opts, cb) {
if (self.getWalletById(w.getId())) { if (self.getWalletById(w.getId())) {
return cb('walletAlreadyExists'); return cb('walletAlreadyExists');
} }
self.addWallet(w);
self.updateFocusedTimestamp(w.getId());
self.bindWallet(w);
self.storeWallet(w, function(err) { self.storeWallet(w, function(err) {
if (err) return cb(err); if (err) return cb(err);
self.addWallet(w);
self.updateFocusedTimestamp(w.getId());
self.bindWallet(w);
self.backupNeeded = true; self.backupNeeded = true;
self.store({ self.store({
noWallets: true, noWallets: true,