diff --git a/js/models/Wallet.js b/js/models/Wallet.js index 70b45e637..e83128774 100644 --- a/js/models/Wallet.js +++ b/js/models/Wallet.js @@ -2452,9 +2452,9 @@ Wallet.prototype.updateIndexes = function(callback) { async.parallel(tasks, function(err) { if (err) callback(err); log.debug('Wallet:' + self.id + ' Indexes updated'); - this.clearUnspentCache(); - this.subscribeToAddresses(); - this.emitAndKeepAlive('newAddresses'); + self.clearUnspentCache(); + self.subscribeToAddresses(); + self.emitAndKeepAlive('newAddresses'); callback(); }); }; diff --git a/js/util/HTTP.js b/js/util/HTTP.js index e900c5334..0c184fb8a 100644 --- a/js/util/HTTP.js +++ b/js/util/HTTP.js @@ -18,6 +18,7 @@ module.exports = { _success: function() {; }, _error: function(_, err) { + console.trace(err); throw err; } }; diff --git a/test/Wallet.js b/test/Wallet.js index 3e2c687a7..18446fe2d 100644 --- a/test/Wallet.js +++ b/test/Wallet.js @@ -687,6 +687,7 @@ describe('Wallet model', function() { amount: u } })); + w.clearUnspentCache(); w.getBalance(function(err, balance, balanceByAddr, safeBalance) { balance.should.equal(c.balance); done(); @@ -821,7 +822,7 @@ describe('Wallet model', function() { should.exist(id); status.should.equal(Wallet.TX_PROPOSAL_SENT); w.sendTxProposal.calledOnce.should.equal(true); - w.sendIndexes.calledOnce.should.equal(true); + w.sendIndexes.calledOnce.should.equal(false); done(); }); }); @@ -861,7 +862,7 @@ describe('Wallet model', function() { }, function(err, id, status) { err.should.equal('error'); w.sendTxProposal.calledOnce.should.equal(false); - w.sendIndexes.calledOnce.should.equal(true); + w.sendIndexes.calledOnce.should.equal(false); done(); }); }); diff --git a/test/util.http.js b/test/util.http.js index 18d7801dc..65453d1fe 100644 --- a/test/util.http.js +++ b/test/util.http.js @@ -75,15 +75,15 @@ describe('http utils', function() { done(); }); }); - it('should get with default error', function() { + it('should get with default error', function(done) { xhr.error = 1; - var ret = httpUtils.request({ xhr: xhr, method: 'GET', url: 'http://test', - }); - ret._error.should.throw() + }).error(function(){ + done(); + }) }); });