Merge pull request #158 from cubedro/develop
Activated send block method
This commit is contained in:
commit
d6effbacaf
16
lib/node.js
16
lib/node.js
@ -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() ) {
|
||||
|
Loading…
Reference in New Issue
Block a user