Merge pull request #106 from cubedro/develop

Changed 'chain' to 'latest'
This commit is contained in:
Marian OANCΞA 2015-05-05 03:13:38 +03:00
commit 6f41ce9ec4
2 changed files with 12 additions and 6 deletions

View File

@ -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'),
@ -46,7 +47,7 @@ if(process.env.NODE_ENV === 'production' && INSTANCE_NAME === "")
}
function Node()
function Node ()
{
this.info = {
name: INSTANCE_NAME || (process.env.EC2_INSTANCE_ID || os.hostname()),
@ -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')) );
@ -128,8 +129,8 @@ Node.prototype.checkWeb3Connection = function()
if( !_.isUndefined(tmp) )
{
console.log('eth ', tmp);
console.info("==> Ethereum connection established");
console.log('eth', tmp);
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();

View File

@ -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",