Merge pull request #85 from cubedro/develop

Added hashrate
This commit is contained in:
Marian OANCΞA 2015-04-24 01:52:35 +03:00
commit 0e83f7c959

View File

@ -79,6 +79,7 @@ function Node()
active: false,
listening: false,
mining: false,
hashrate: 0,
peers: 0,
pending: 0,
gasPrice: 0,
@ -393,6 +394,23 @@ Node.prototype.getStats = function()
}
this.stats.mining = web3.eth.mining;
if(this.stats.mining)
{
try {
this.stats.hashrate = web3.eth.hashRate;
}
catch (err)
{
console.error('hashrate: ', err);
this.stats.hashrate = 0;
}
}
else
{
this.stats.hashrate = 0;
}
this.stats.gasPrice = web3.toBigNumber(web3.eth.gasPrice).toString(10);
} else {
console.error("getStats: couldn't fetch block...");