From 1ab279ab159fefe1ac1e38cf76672e5a6d834764 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 9 Feb 2015 18:26:25 -0300 Subject: [PATCH] rm copayers first --- lib/storage.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/storage.js b/lib/storage.js index dd00f6b..e637516 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -241,7 +241,7 @@ Storage.prototype._removeCopayers = function(walletId, cb) { var self = this; this.fetchWallet(walletId, function(err, w) { - if (err) return cb(err); + if (err || !w) return cb(err); self.db.batch(_.map(w.copayers, function(c) { return { @@ -262,7 +262,9 @@ Storage.prototype.removeWallet = function(walletId, cb) { var self = this; async.series([ - + function(next) { + self._removeCopayers(walletId, next); + }, function(next) { self._removeAllAddresses(walletId, next); }, @@ -272,9 +274,6 @@ Storage.prototype.removeWallet = function(walletId, cb) { function(next) { self.removeAllTxs(walletId, next); }, - function(next) { - self._removeCopayers(walletId, next); - }, function(next) { var ops = [{ type: 'del',