added block check
This commit is contained in:
parent
9ed6bfe0f0
commit
cce918ba95
@ -196,6 +196,8 @@ Node.prototype.getBlock = function(number)
|
|||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error("getBlock(" + number + "):", err);
|
console.error("getBlock(" + number + "):", err);
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
@ -354,8 +356,10 @@ Node.prototype.getStats = function()
|
|||||||
|
|
||||||
if(this.isActive())
|
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
|
// Get last MAX_BLOCKS_HISTORY blocks for calculations
|
||||||
if(this.stats.block.number > 0)
|
if(this.stats.block.number > 0)
|
||||||
this.getLatestBlocks();
|
this.getLatestBlocks();
|
||||||
@ -372,6 +376,7 @@ Node.prototype.getStats = function()
|
|||||||
this.stats.mining = web3.eth.mining;
|
this.stats.mining = web3.eth.mining;
|
||||||
this.stats.gasPrice = web3.toBigNumber(web3.eth.gasPrice).toString(10);
|
this.stats.gasPrice = web3.toBigNumber(web3.eth.gasPrice).toString(10);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.uptime();
|
this.uptime();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user