store new block notifications with walletId=network

This commit is contained in:
Ivan Socolsky 2015-10-19 13:09:33 -03:00
parent 781f2c44b7
commit bee66435e9
1 changed files with 4 additions and 3 deletions

View File

@ -83,7 +83,7 @@ BlockchainMonitor.prototype._initExplorer = function(explorer) {
log.error('Error connecting to ' + explorer.getConnectionInfo()); log.error('Error connecting to ' + explorer.getConnectionInfo());
}); });
socket.on('tx', _.bind(self._handleIncommingTx, self)); socket.on('tx', _.bind(self._handleIncommingTx, self));
socket.on('block', _.bind(self._handleNewBlock, self)); socket.on('block', _.bind(self._handleNewBlock, self, explorer.network));
}; };
BlockchainMonitor.prototype._handleTxId = function(data, processIt) { BlockchainMonitor.prototype._handleTxId = function(data, processIt) {
@ -177,12 +177,13 @@ BlockchainMonitor.prototype._handleIncommingTx = function(data) {
this._handleTxOuts(data); this._handleTxOuts(data);
}; };
BlockchainMonitor.prototype._handleNewBlock = function(hash) { BlockchainMonitor.prototype._handleNewBlock = function(network, hash) {
var self = this; var self = this;
log.info('New block: ', hash); log.info('New ' + network + ' block: ', hash);
var notification = Notification.create({ var notification = Notification.create({
type: 'NewBlock', type: 'NewBlock',
walletId: network, // use network name as wallet id for global notifications
data: { data: {
hash: hash, hash: hash,
}, },