fixes and added angular moment
This commit is contained in:
@@ -2,8 +2,6 @@ var geoip = require('geoip-lite');
|
||||
|
||||
require('es6-promise').polyfill();
|
||||
|
||||
var self;
|
||||
|
||||
var Node = function Node(options, id)
|
||||
{
|
||||
this.info = options;
|
||||
@@ -27,21 +25,19 @@ var Node = function Node(options, id)
|
||||
|
||||
Node.prototype.update = function()
|
||||
{
|
||||
if( ! this.web3.haveProvider()) {
|
||||
var sock = new this.web3.providers.HttpSyncProvider('http://' + this.info.rpcHost + ':' + this.info.rpcPort);
|
||||
this.web3.setProvider(sock);
|
||||
}
|
||||
var sock = new this.web3.providers.HttpSyncProvider('http://' + this.info.rpcHost + ':' + this.info.rpcPort);
|
||||
this.web3.setProvider(sock);
|
||||
|
||||
var eth = this.web3.eth;
|
||||
|
||||
try {
|
||||
this.info.stats.peers = parseInt(eth.peerCount);
|
||||
this.info.stats.peers = eth.peerCount;
|
||||
}
|
||||
catch (err) {
|
||||
this.info.stats.peers = 0;
|
||||
this.info.stats.peers = null;
|
||||
}
|
||||
|
||||
if(this.info.stats.peers > 0) {
|
||||
if(this.info.stats.peers != null) {
|
||||
this.info.stats.block.height = eth.number;
|
||||
var block = eth.block(this.info.stats.block.height)
|
||||
this.info.stats.block.hash = block.hash;
|
||||
|
||||
Reference in New Issue
Block a user