fixed recentBlock & increased block history

This commit is contained in:
cubedro 2015-03-28 01:28:55 +02:00
parent 3652e58b7f
commit 13f96e05e5

View File

@ -30,7 +30,7 @@ if(process.env.NODE_ENV === 'production' && INSTANCE_NAME === "")
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 MAX_BLOCKS_HISTORY = 12;
var MAX_BLOCKS_HISTORY = 36;
function Node()
{
@ -165,7 +165,7 @@ Node.prototype.getBlock = function(number)
try {
number = web3.eth.blockNumber;
if(number === this.stats.block.number + 1)
if(number === this.stats.block.number)
return this.stats.block;
}
catch (err) {
@ -343,18 +343,18 @@ Node.prototype.setWatches = function()
{
var self = this;
this.pendingFilter = web3.eth.filter('pending');
this.pendingFilter.watch( function(log) {
console.log('pending changed', log);
// console.log(self.pendingFilter.get());
// self.stats.pending = parseInt(log.number);
});
// this.pendingFilter = web3.eth.filter('pending');
// this.pendingFilter.watch( function(log) {
// console.log('pending changed', log);
// // console.log(self.pendingFilter.get());
// // self.stats.pending = parseInt(log.number);
// });
this.chainFilter = web3.eth.filter('latest');
this.chainFilter.watch(function(log) {
console.log('block changed:', log);
// self.update();
});
// this.chainFilter = web3.eth.filter('latest');
// this.chainFilter.watch(function(log) {
// console.log('block changed:', log);
// // self.update();
// });
this.updateInterval = setInterval(function(){
self.update();