changed direction of history iteration

This commit is contained in:
cubedro 2015-04-29 08:58:11 +03:00
parent 3f962fb9a8
commit 9d8b1483fe
2 changed files with 3 additions and 4 deletions

View File

@ -46,7 +46,8 @@ Collection.prototype.addHistory = function(id, blocks)
if(!node)
return false;
console.log(blocks);
blocks = blocks.reverse();
for (var i = 0; i <= blocks.length - 1; i++)
{
this._blockchain.add(blocks[i], id);

View File

@ -388,9 +388,7 @@ History.prototype.getHistoryRequestRange = function()
var missing = _.difference( range, blocks );
console.log('missing', missing.join(', '));
var max = _.min(this._items, 'height').height - 1;
var max = _.max(missing);
var min = max - Math.min( 50, (MAX_HISTORY - this._items.length + 1) ) + 1;
return {max: max, min: min};