fixed bug
This commit is contained in:
parent
563ad5cc0a
commit
6c0bf268b5
14
lib/node.js
14
lib/node.js
@ -25,8 +25,8 @@ if(process.env.NODE_ENV === 'production')
|
|||||||
INSTANCE_NAME = shelljs.exec('ec2metadata --instance-id', {silent: true}).output;
|
INSTANCE_NAME = shelljs.exec('ec2metadata --instance-id', {silent: true}).output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ETH_VERSION = shelljs.exec((process.env.ETH_IMPLEMENTATION === 'go' ? 'ethereum version' : 'eth -V'), {silent: true}).output;
|
|
||||||
}
|
}
|
||||||
|
ETH_VERSION = shelljs.exec((process.env.ETH_IMPLEMENTATION === 'go' ? 'ethereum version' : 'eth -V'), {silent: true}).output;
|
||||||
|
|
||||||
var socket = new Socket(process.env.WS_SERVER || 'ws://localhost:3000');
|
var socket = new Socket(process.env.WS_SERVER || 'ws://localhost:3000');
|
||||||
var WS_SECRET = process.env.WS_SECRET || "eth-net-stats-has-a-secret";
|
var WS_SECRET = process.env.WS_SECRET || "eth-net-stats-has-a-secret";
|
||||||
@ -37,9 +37,14 @@ function Node()
|
|||||||
{
|
{
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
web3.setProvider(new web3.providers.HttpProvider('http://' + (process.env.RPC_HOST || 'localhost') + ':' + (process.env.RPC_PORT || '8080')));
|
web3.setProvider(new web3.providers.HttpProvider('http://' + (process.env.RPC_HOST || 'localhost') + ':' + (process.env.RPC_PORT || '8545')));
|
||||||
|
|
||||||
|
try {
|
||||||
ETH_VERSION = web3.version;
|
ETH_VERSION = web3.version;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.log("couldn't get Version");
|
||||||
|
}
|
||||||
|
|
||||||
this.info = {
|
this.info = {
|
||||||
name: INSTANCE_NAME || (process.env.EC2_INSTANCE_ID || os.hostname()),
|
name: INSTANCE_NAME || (process.env.EC2_INSTANCE_ID || os.hostname()),
|
||||||
@ -295,7 +300,7 @@ Node.prototype.getStats = function()
|
|||||||
this.getLatestBlocks();
|
this.getLatestBlocks();
|
||||||
|
|
||||||
this.stats.mining = web3.eth.mining;
|
this.stats.mining = web3.eth.mining;
|
||||||
this.stats.gasPrice = web3.toDecimal(web3.eth.gasPrice);
|
this.stats.gasPrice = web3.eth.gasPrice.toString(10);
|
||||||
this.stats.listening = web3.net.listening;
|
this.stats.listening = web3.net.listening;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,6 +351,7 @@ Node.prototype.setWatches = function()
|
|||||||
this.pendingWatch = web3.eth.filter('pending');
|
this.pendingWatch = web3.eth.filter('pending');
|
||||||
this.pendingWatch.watch( function(log) {
|
this.pendingWatch.watch( function(log) {
|
||||||
console.log(log);
|
console.log(log);
|
||||||
|
console.log(self.pendingWatch.get());
|
||||||
// console.log('pending changed');
|
// console.log('pending changed');
|
||||||
// self.stats.pending = parseInt(log.number);
|
// self.stats.pending = parseInt(log.number);
|
||||||
});
|
});
|
||||||
@ -384,6 +390,8 @@ Node.prototype.stop = function()
|
|||||||
if(this._socket)
|
if(this._socket)
|
||||||
socket.end();
|
socket.end();
|
||||||
|
|
||||||
|
web3.reset();
|
||||||
|
|
||||||
if(this.updateInterval)
|
if(this.updateInterval)
|
||||||
clearInterval(this.updateInterval);
|
clearInterval(this.updateInterval);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user