Only request mining info when node is mining

This commit is contained in:
Lucas Saldanha 2018-11-14 11:37:13 +13:00
parent bdc192ebb7
commit 49cb32b81c
1 changed files with 6 additions and 2 deletions

View File

@ -336,7 +336,9 @@ Node.prototype.getInfo = function()
console.time('Got info');
try {
this.info.coinbase = web3.eth.coinbase;
if (web3.eth.mining) {
this.info.coinbase = web3.eth.coinbase;
}
this.info.node = web3.version.node;
this.info.net = web3.version.network;
this.info.protocol = web3.toDecimal(web3.version.ethereum);
@ -489,7 +491,9 @@ Node.prototype.getStats = function(forced)
},
hashrate: function (callback)
{
web3.eth.getHashrate(callback);
if (web3.eth.mining) {
web3.eth.getHashrate(callback);
}
},
gasPrice: function (callback)
{