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,11 +683,13 @@ Identity.prototype.createWallet = function(opts, cb) {
if (self.getWalletById(w.getId())) { if (self.getWalletById(w.getId())) {
return cb('walletAlreadyExists'); return cb('walletAlreadyExists');
} }
self.storeWallet(w, function(err) {
if (err) return cb(err);
self.addWallet(w); self.addWallet(w);
self.updateFocusedTimestamp(w.getId()); self.updateFocusedTimestamp(w.getId());
self.bindWallet(w); self.bindWallet(w);
self.storeWallet(w, function(err) {
if (err) return cb(err);
self.backupNeeded = true; self.backupNeeded = true;
self.store({ self.store({