Fix block history if chain is shorted than MAX_HISTORY.

This commit is contained in:
Péter Szilágyi 2017-03-23 15:21:12 +02:00 committed by Ikmyeong Na
parent 2e5d3ac4e1
commit a4cede7016
No known key found for this signature in database
GPG Key ID: EC674310ADADE2CA

View File

@ -169,7 +169,7 @@ History.prototype.add = function(block, id, trusted, addingHistory)
propagTimes: [] propagTimes: []
} }
if( this._items.length === 0 || (this._items.length === MAX_HISTORY && block.number > this.worstBlockNumber()) || (this._items.length < MAX_HISTORY && block.number < this.bestBlockNumber() && addingHistory) ) if( this._items.length === 0 || (this._items.length > 0 && block.number > this.worstBlockNumber()) || (this._items.length < MAX_HISTORY && block.number < this.bestBlockNumber() && addingHistory) )
{ {
item.propagTimes.push({ item.propagTimes.push({
node: id, node: id,