fixed history sync bug

This commit is contained in:
cubedro 2015-10-28 22:59:57 +02:00
parent b092bfdf6c
commit 33f6cd17e9
2 changed files with 4 additions and 4 deletions

View File

@ -44,7 +44,7 @@ Collection.prototype.update = function(id, stats, callback)
} }
else else
{ {
this._blockchain.clean(this.getBestBlockFromItems()); // this._blockchain.clean(this.getBestBlockFromItems());
var block = this._blockchain.add(stats.block, id, node.trusted); var block = this._blockchain.add(stats.block, id, node.trusted);
@ -75,7 +75,7 @@ Collection.prototype.addBlock = function(id, stats, callback)
} }
else else
{ {
this._blockchain.clean(this.getBestBlockFromItems()); // this._blockchain.clean(this.getBestBlockFromItems());
var block = this._blockchain.add(stats, id, node.trusted); var block = this._blockchain.add(stats, id, node.trusted);
@ -142,7 +142,7 @@ Collection.prototype.addHistory = function(id, blocks, callback)
{ {
blocks = blocks.reverse(); blocks = blocks.reverse();
this._blockchain.clean(this.getBestBlockFromItems()); // this._blockchain.clean(this.getBestBlockFromItems());
for (var i = 0; i <= blocks.length - 1; i++) for (var i = 0; i <= blocks.length - 1; i++)
{ {

View File

@ -639,7 +639,7 @@ History.prototype.requiresUpdate = function()
History.prototype.getHistoryRequestRange = function() History.prototype.getHistoryRequestRange = function()
{ {
if( _.isEmpty(this._items) ) if( this._items.length < 5 )
return false; return false;
var blocks = _.pluck( this._items, 'height' ); var blocks = _.pluck( this._items, 'height' );