added block check

This commit is contained in:
cubedro 2015-04-16 23:45:23 +03:00
parent 9ed6bfe0f0
commit cce918ba95

View File

@ -196,6 +196,8 @@ Node.prototype.getBlock = function(number)
}
catch (err) {
console.error("getBlock(" + number + "):", err);
return false;
}
return block;
@ -354,8 +356,10 @@ Node.prototype.getStats = function()
if(this.isActive())
{
this.stats.block = this.getBlock();
var block = this.getBlock();
if(block) {
this.stats.block = block;
// Get last MAX_BLOCKS_HISTORY blocks for calculations
if(this.stats.block.number > 0)
this.getLatestBlocks();
@ -372,6 +376,7 @@ Node.prototype.getStats = function()
this.stats.mining = web3.eth.mining;
this.stats.gasPrice = web3.toBigNumber(web3.eth.gasPrice).toString(10);
}
}
this.uptime();
}