From 33f6cd17e9ac18f58adcd53efdef510ce28dba37 Mon Sep 17 00:00:00 2001 From: cubedro Date: Wed, 28 Oct 2015 22:59:57 +0200 Subject: [PATCH] fixed history sync bug --- lib/collection.js | 6 +++--- lib/history.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/collection.js b/lib/collection.js index 3e7e0fc..d3149f4 100644 --- a/lib/collection.js +++ b/lib/collection.js @@ -44,7 +44,7 @@ Collection.prototype.update = function(id, stats, callback) } else { - this._blockchain.clean(this.getBestBlockFromItems()); + // this._blockchain.clean(this.getBestBlockFromItems()); var block = this._blockchain.add(stats.block, id, node.trusted); @@ -75,7 +75,7 @@ Collection.prototype.addBlock = function(id, stats, callback) } else { - this._blockchain.clean(this.getBestBlockFromItems()); + // this._blockchain.clean(this.getBestBlockFromItems()); var block = this._blockchain.add(stats, id, node.trusted); @@ -142,7 +142,7 @@ Collection.prototype.addHistory = function(id, blocks, callback) { blocks = blocks.reverse(); - this._blockchain.clean(this.getBestBlockFromItems()); + // this._blockchain.clean(this.getBestBlockFromItems()); for (var i = 0; i <= blocks.length - 1; i++) { diff --git a/lib/history.js b/lib/history.js index 43faf0b..5599f6e 100644 --- a/lib/history.js +++ b/lib/history.js @@ -639,7 +639,7 @@ History.prototype.requiresUpdate = function() History.prototype.getHistoryRequestRange = function() { - if( _.isEmpty(this._items) ) + if( this._items.length < 5 ) return false; var blocks = _.pluck( this._items, 'height' );