returning error when allet already exists in profile

This commit is contained in:
Ivan Socolsky 2014-12-03 19:20:51 -03:00
commit bd0ddf5c8c
3 changed files with 13 additions and 1 deletions

View file

@ -575,6 +575,11 @@ Identity.prototype.createWallet = function(opts, cb) {
var self = this;
var w = new walletClass(opts);
if (_.contains(_.keys(self.wallets), w.getId())) {
return cb('walletAlreadyExists');
}
self.wallets[w.getId()] = w;
self.updateFocusedTimestamp(w.getId());
self.bindWallet(w);