Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch errer - Couldn't get version when none coinbase #2

Open
wants to merge 3 commits into
base: pool
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions lib/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
});
});
Expand Down Expand Up @@ -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;
Expand Down