diff --git a/app.js b/app.js index 3f87e98..3f87862 100644 --- a/app.js +++ b/app.js @@ -316,7 +316,8 @@ api.on('connection', function (spark) { if( !_.isUndefined(data.id) ) { - Nodes.updateLatency(data.id, data.latency, function (err, latency) { + Nodes.updateLatency(data.id, data.latency, function (err, latency) + { if(err !== null) { console.error('API', 'PIN', 'Latency error:', err); @@ -333,7 +334,7 @@ api.on('connection', function (spark) } }); - if( Nodes.requiresUpdate(data.id) && (!Nodes.askedForHistory() || _.now() - askedForHistoryTime > 200000) ) + if( Nodes.requiresUpdate(data.id) && (!Nodes.askedForHistory() || _.now() - askedForHistoryTime > 2*60*1000) ) { var range = Nodes.getHistory().getHistoryRequestRange(); diff --git a/lib/collection.js b/lib/collection.js index 16bfb11..ab22335 100644 --- a/lib/collection.js +++ b/lib/collection.js @@ -61,7 +61,6 @@ Collection.prototype.addBlock = function(id, stats, callback) if (!block) { - console.log(block); callback('Block undefined', null); } else @@ -119,7 +118,7 @@ Collection.prototype.addHistory = function(id, blocks, callback) this._blockchain.add(blocks[i], id); }; - this.getCharts(callback); + this.getCharts(); } this.askedForHistory(false); diff --git a/lib/history.js b/lib/history.js index 57e0d57..0e3367a 100644 --- a/lib/history.js +++ b/lib/history.js @@ -110,14 +110,14 @@ History.prototype.add = function(block, id) block.time = 0; } + var item = { + height: block.number, + block: block, + propagTimes: [] + } + if( this._items.length === 0 || block.number >= (this.bestBlockNumber() - MAX_HISTORY + 1) ) { - var item = { - height: block.number, - block: block, - propagTimes: [] - } - item.propagTimes.push({ node: id, received: now, diff --git a/lib/node.js b/lib/node.js index c406330..b6c244d 100644 --- a/lib/node.js +++ b/lib/node.js @@ -158,7 +158,6 @@ Node.prototype.setBlock = function(block, history, callback) } else { - console.log(block); callback('Block undefined', null); } }