From 73f4d4978d0bb7466f64d23af20a2f700c99e245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Thu, 23 Mar 2017 15:21:12 +0200 Subject: [PATCH] Fix block history if chain is shorted than MAX_HISTORY. --- lib/history.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/history.js b/lib/history.js index f71d61a..82cde66 100644 --- a/lib/history.js +++ b/lib/history.js @@ -169,7 +169,7 @@ History.prototype.add = function(block, id, trusted, addingHistory) 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({ node: id,