diff --git a/lib/node.js b/lib/node.js index ae77f4bf..006c62d2 100644 --- a/lib/node.js +++ b/lib/node.js @@ -3,7 +3,10 @@ require('./utils/logger.js'); var http = require('http'); +<<<<<<< HEAD +======= var https = require('https'); +>>>>>>> upstream/pool var os = require('os'); var Web3 = require('web3'); var web3; @@ -357,6 +360,11 @@ Node.prototype.getInfo = function() try { this.info.coinbase = web3.eth.coinbase; + } + catch (err) { + this.info.coinbase = null; + } + try { this.info.node = web3.version.node; this.info.net = web3.version.network; this.info.protocol = web3.toDecimal(web3.version.ethereum); @@ -533,24 +541,48 @@ Node.prototype.getStats = function(forced) }, pool: function (callback) { +<<<<<<< HEAD + web3.eth.getHashrate(callback); + }, + gasPrice: function (callback) + { + web3.eth.getGasPrice(callback); + }, + syncing: function (callback) + { + web3.eth.getSyncing(callback); + }, + pool: function (callback) + { +======= +>>>>>>> upstream/pool if (poolOptions == null) { callback(null, {hashrate: 0, minersTotal: 0}); return; } +<<<<<<< HEAD + http.get(poolOptions, function(res) { +======= var request = http; if (poolOptions.port == 443) { request = https; } request.get(poolOptions, function(res) { +>>>>>>> upstream/pool if (res.statusCode != 200) { console.error('Status:', res.statusCode); } +<<<<<<< HEAD + res.on('data', function(data) { + var result = JSON.parse(data); +======= var buffer = new Buffer.from(''); res.on('data', function(data) { buffer = Buffer.concat([buffer, data]); }).on('end', function() { var result = JSON.parse(buffer); +>>>>>>> upstream/pool callback(null, result); }); }); @@ -590,8 +622,18 @@ Node.prototype.getStats = function(forced) // sum hashrates self.stats.hashrate += results.pool.hashrate; +<<<<<<< HEAD + // setup pool stats + self.stats.pool = results.pool; + // sum hashares + self.stats.hashrate += results.pool.hashrate; + + if(results.syncing !== false) { + var sync = results.syncing; +======= if(results.all.syncing !== false) { var sync = results.all.syncing; +>>>>>>> upstream/pool var progress = sync.currentBlock - sync.startingBlock; var total = sync.highestBlock - sync.startingBlock;