fix delete wallet

This commit is contained in:
Ivan Socolsky 2014-10-15 15:54:17 -03:00 committed by Matias Alejo Garcia
commit e3107c85ac
3 changed files with 3 additions and 5 deletions

View file

@ -518,7 +518,6 @@ Identity.prototype.listWallets = function() {
*/
Identity.prototype.deleteWallet = function(walletId, cb) {
var self = this;
Identity._walletDelete(walletId, this.storage, function(err) {
if (err) return cb(err);
self.profile.deleteWallet(walletId, function(err) {

View file

@ -86,7 +86,6 @@ Profile.prototype.deleteWallet = function(walletId, cb) {
return cb(new Error('WNOEXIST: Wallet not on profile '));
delete this.walletInfos[walletId];
this.store({
overwrite: true
}, cb);

View file

@ -230,11 +230,11 @@ Wallet.getMaxRequiredCopayers = function(totalCopayers) {
*/
Wallet.delete = function(walletId, storage, cb) {
preconditions.checkArgument(cb);
storage.deletePrefix(Wallet.key(walletId), function(err) {
if (err) return cb(err);
if (err && err.message != 'not found') return cb(err);
storage.deletePrefix(walletId + '::', function(err) {
return cb(err);
if (err && err.message != 'not found') return cb(err);
return cb();
});
});
};