From 13ca84f077260d8fa3fcbf5b5761e45f98195af5 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Tue, 9 Aug 2016 09:31:03 -0300 Subject: [PATCH 1/2] fix cache reset --- lib/server.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/server.js b/lib/server.js index 0a9a703..d30bedd 100644 --- a/lib/server.js +++ b/lib/server.js @@ -2448,7 +2448,7 @@ WalletService.prototype._normalizeTxHistory = function(txs) { }); }; -WalletService._cachedBlockheight; +WalletService._cachedBlockheight = {}; WalletService._clearBlockchainHeightCache = function() { WalletService._cachedBlockheight.current = null; }; @@ -2457,7 +2457,6 @@ WalletService.prototype._getBlockchainHeight = function(network, cb) { var self = this; var now = Date.now(); - if (!WalletService._cachedBlockheight) WalletService._cachedBlockheight = {}; var cache = WalletService._cachedBlockheight; function fetchFromBlockchain(cb) { From 756e3d740a6e3023090cc81f9b1401a9760f2921 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Tue, 9 Aug 2016 09:33:56 -0300 Subject: [PATCH 2/2] fix tests --- test/integration/server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/server.js b/test/integration/server.js index b032293..9d61314 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -5930,7 +5930,7 @@ describe('Wallet service', function() { it('should get real # of confirmations based on current block height', function(done) { var _confirmations = Defaults.CONFIRMATIONS_TO_START_CACHING; Defaults.CONFIRMATIONS_TO_START_CACHING = 6; - WalletService._cachedBlockheight = null; + WalletService._cachedBlockheight = {}; var h = helpers.historyCacheTest(20); _.each(h, function(x, i) { @@ -5989,7 +5989,7 @@ describe('Wallet service', function() { it('should get cached # of confirmations if current height unknown', function(done) { var _confirmations = Defaults.CONFIRMATIONS_TO_START_CACHING; Defaults.CONFIRMATIONS_TO_START_CACHING = 6; - WalletService._cachedBlockheight = null; + WalletService._cachedBlockheight = {}; var h = helpers.historyCacheTest(20); helpers.stubHistory(h);