From 49cb32b81cd64f8d19c61649b399091a733f7273 Mon Sep 17 00:00:00 2001 From: Lucas Saldanha Date: Wed, 14 Nov 2018 11:37:13 +1300 Subject: [PATCH] Only request mining info when node is mining --- lib/node.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/node.js b/lib/node.js index 59103aa..82ab4bd 100644 --- a/lib/node.js +++ b/lib/node.js @@ -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) {