activated send block method

This commit is contained in:
cubedro 2015-06-01 23:23:45 +03:00
parent fdec28938d
commit 098a93047b
1 changed files with 8 additions and 8 deletions

View File

@ -354,9 +354,6 @@ Node.prototype.getLatestBlock = function ()
{
var self = this;
if(this._socket)
this._lastStats = JSON.stringify(this.stats);
if(this._web3)
{
var timeString = 'Got block in' + chalk.reset.red('');
@ -399,7 +396,7 @@ Node.prototype.validateLatestBlock = function (error, result, timeString)
console.success("==>", "Got block:", chalk.reset.red(block.number));
this.stats.block = block;
this.sendUpdate();
this.sendBlockUpdate();
if(this.stats.block.number - this._lastBlock > 1)
{
@ -480,7 +477,7 @@ Node.prototype.getStats = function(forced)
self.setUptime();
self.sendUpdate();
self.sendUpdate(forced);
});
}
}
@ -490,9 +487,6 @@ Node.prototype.getPending = function()
var self = this;
var now = _.now();
if (this._socket)
this._lastStats = JSON.stringify(this.stats);
if (this._web3)
{
console.info('==>', 'Getting Pending')
@ -620,6 +614,12 @@ Node.prototype.sendUpdate = function (force)
}
}
Node.prototype.sendBlockUpdate = function()
{
console.info("wsc", "Sending", chalk.reset.red("block"), chalk.bold.white("update"));
this.emit('block', this.prepareBlock());
}
Node.prototype.sendPendingUpdate = function()
{
if( this.changed() ) {