From 94becc89609cf9e55e548de665e3325d8476c3a1 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 12 Jun 2015 10:06:15 -0300 Subject: [PATCH] fix notify order --- lib/server.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/server.js b/lib/server.js index c1277ee..9f0da68 100644 --- a/lib/server.js +++ b/lib/server.js @@ -858,7 +858,7 @@ WalletService.prototype.getRemainingDeleteLockTime = function(txp) { var approvers = txp.getApprovers(); if (approvers.length > 1 || (approvers.length == 1 && approvers[0] !== this.copayerId)) return lockTimeRemaining; - + return 0; }; @@ -891,9 +891,8 @@ WalletService.prototype.removePendingTx = function(opts, cb) { if (deleteLockTime > 0) { return cb(new ClientError('TXCANNOTREMOVE', 'Cannot remove this tx proposal during locktime. Time remaining:' + deleteLockTime)); } - - self._notify('TxProposalRemoved', {}, function() { - self.storage.removeTx(self.walletId, txp.id, cb); + self.storage.removeTx(self.walletId, txp.id, function() { + self._notify('TxProposalRemoved', {}, cb); }); }); }); @@ -1120,7 +1119,7 @@ WalletService.prototype.getPendingTxs = function(opts, cb) { self.storage.fetchPendingTxs(self.walletId, function(err, txps) { if (err) return cb(err); - _.each(txps,function(txp){ + _.each(txps, function(txp) { txp.deleteLockTime = self.getRemainingDeleteLockTime(txp); });