changed 'chain' to 'latest'

This commit is contained in:
cubedro 2015-05-05 03:12:41 +03:00
parent c2f8a103bd
commit 99edf03c35
2 changed files with 12 additions and 6 deletions

View File

@ -8,6 +8,7 @@ var shelljs = require('shelljs');
var debounce = require('debounce'); var debounce = require('debounce');
var registrar = require('./registrar.js'); var registrar = require('./registrar.js');
var pjson = require('./../package.json'); var pjson = require('./../package.json');
var chalk = require('chalk');
var Primus = require('primus'), var Primus = require('primus'),
Emitter = require('primus-emit'), Emitter = require('primus-emit'),
@ -110,7 +111,7 @@ function Node()
Node.prototype.startWeb3Connection = function() 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')) ); 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) ) if( !_.isUndefined(tmp) )
{ {
console.log('eth', tmp); console.log('eth', tmp);
console.info("==> Ethereum connection established"); console.info('==>', 'Ethereum connection established');
this._web3 = true; this._web3 = true;
this.init(); this.init();
@ -139,7 +140,7 @@ Node.prototype.checkWeb3Connection = function()
} }
catch(err) catch(err)
{ {
console.error('xx> Ethereum connection attempt #' + this._called++ + ' failed;'); console.error('xx>', 'Ethereum connection attempt #' + this._called++ + ' failed;');
process.nextTick( function() process.nextTick( function()
{ {
@ -516,6 +517,8 @@ Node.prototype.getHistory = function (range)
var history = []; var history = [];
var interv = {}; var interv = {};
console.time('=== Got history in');
if( _.isUndefined(range) || range === null) if( _.isUndefined(range) || range === null)
{ {
interv = { interv = {
@ -542,6 +545,8 @@ Node.prototype.getHistory = function (range)
} }
} }
console.timeEnd('=== Got history in');
return history.reverse(); return history.reverse();
} }
@ -591,7 +596,7 @@ Node.prototype.setWatches = function()
var self = this; var self = this;
try { try {
this.chainFilter = web3.eth.filter('chain'); this.chainFilter = web3.eth.filter('latest');
this.chainFilter.watch( function (log) this.chainFilter.watch( function (log)
{ {
var now = _.now(); var now = _.now();

View File

@ -9,6 +9,7 @@
}, },
"dependencies": { "dependencies": {
"async": "^0.9.0", "async": "^0.9.0",
"chalk": "^1.0.0",
"debounce": "1.0.0", "debounce": "1.0.0",
"debug": "2.1.3", "debug": "2.1.3",
"lodash": "3.7.0", "lodash": "3.7.0",