Browse Source

reset cache by network

activeAddress
Ivan Socolsky 9 years ago
parent
commit
8494f79f89
No known key found for this signature in database GPG Key ID: FAECE6A05FAA4F56
  1. 1
      lib/blockchainmonitor.js
  2. 12
      lib/server.js

1
lib/blockchainmonitor.js

@ -205,6 +205,7 @@ BlockchainMonitor.prototype._handleNewBlock = function(network, hash) {
walletId: network, // use network name as wallet id for global notifications
data: {
hash: hash,
network: network,
},
});

12
lib/server.js

@ -157,7 +157,8 @@ WalletService.handleIncomingNotification = function(notification, cb) {
cb = cb || function() {};
if (!notification || notification.type != 'NewBlock') return cb();
WalletService._clearBlockchainHeightCache();
WalletService._clearBlockchainHeightCache(notification.data.network);
return cb();
};
@ -2458,10 +2459,13 @@ WalletService._initBlockchainHeightCache = function() {
};
};
WalletService._clearBlockchainHeightCache = function() {
WalletService._clearBlockchainHeightCache = function(network) {
WalletService._initBlockchainHeightCache();
WalletService._cachedBlockheight.livenet.current = null;
WalletService._cachedBlockheight.testnet.current = null;
if (!_.contains(['livenet', 'testnet'], network)) {
log.error('Incorrect network in new block: ' + network);
return;
}
WalletService._cachedBlockheight[network].current = null;
};
WalletService.prototype._getBlockchainHeight = function(network, cb) {

Loading…
Cancel
Save