Merge pull request #106 from cubedro/develop
Changed 'chain' to 'latest'
This commit is contained in:
commit
6f41ce9ec4
13
lib/node.js
13
lib/node.js
@ -8,6 +8,7 @@ var shelljs = require('shelljs');
|
||||
var debounce = require('debounce');
|
||||
var registrar = require('./registrar.js');
|
||||
var pjson = require('./../package.json');
|
||||
var chalk = require('chalk');
|
||||
|
||||
var Primus = require('primus'),
|
||||
Emitter = require('primus-emit'),
|
||||
@ -110,7 +111,7 @@ function Node()
|
||||
|
||||
Node.prototype.startWeb3Connection = function()
|
||||
{
|
||||
console.info("==> Starting eth connection");
|
||||
console.info(chalk.blue('==>'), chalk.bold('Starting eth connection'));
|
||||
|
||||
web3.setProvider( new web3.providers.HttpProvider('http://' + (process.env.RPC_HOST || 'localhost') + ':' + (process.env.RPC_PORT || '8080')) );
|
||||
|
||||
@ -129,7 +130,7 @@ Node.prototype.checkWeb3Connection = function()
|
||||
if( !_.isUndefined(tmp) )
|
||||
{
|
||||
console.log('eth', tmp);
|
||||
console.info("==> Ethereum connection established");
|
||||
console.info('==>', 'Ethereum connection established');
|
||||
|
||||
this._web3 = true;
|
||||
this.init();
|
||||
@ -139,7 +140,7 @@ Node.prototype.checkWeb3Connection = function()
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
console.error('xx> Ethereum connection attempt #' + this._called++ + ' failed;');
|
||||
console.error('xx>', 'Ethereum connection attempt #' + this._called++ + ' failed;');
|
||||
|
||||
process.nextTick( function()
|
||||
{
|
||||
@ -516,6 +517,8 @@ Node.prototype.getHistory = function (range)
|
||||
var history = [];
|
||||
var interv = {};
|
||||
|
||||
console.time('=== Got history in');
|
||||
|
||||
if( _.isUndefined(range) || range === null)
|
||||
{
|
||||
interv = {
|
||||
@ -542,6 +545,8 @@ Node.prototype.getHistory = function (range)
|
||||
}
|
||||
}
|
||||
|
||||
console.timeEnd('=== Got history in');
|
||||
|
||||
return history.reverse();
|
||||
}
|
||||
|
||||
@ -591,7 +596,7 @@ Node.prototype.setWatches = function()
|
||||
var self = this;
|
||||
|
||||
try {
|
||||
this.chainFilter = web3.eth.filter('chain');
|
||||
this.chainFilter = web3.eth.filter('latest');
|
||||
this.chainFilter.watch( function (log)
|
||||
{
|
||||
var now = _.now();
|
||||
|
@ -9,6 +9,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "^0.9.0",
|
||||
"chalk": "^1.0.0",
|
||||
"debounce": "1.0.0",
|
||||
"debug": "2.1.3",
|
||||
"lodash": "3.7.0",
|
||||
|
Loading…
Reference in New Issue
Block a user