From b8e73ae238c5dcdf42c8a51cc6ff5ae1b79d4d61 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Mon, 25 Sep 2017 15:45:15 -0400 Subject: [PATCH] Fixed sanity check when block height is zero. --- lib/services/block/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/services/block/index.js b/lib/services/block/index.js index 12f4c883..79786dbc 100644 --- a/lib/services/block/index.js +++ b/lib/services/block/index.js @@ -310,6 +310,11 @@ BlockService.prototype._resetTip = function(callback) { BlockService.prototype._performSanityCheck = function(tip, callback) { var self = this; + + if (tip.height === 0) { + return callback(null, tip); + } + // is our tip saved in our database? If not, then find the latest block that is in // in our database and set the tip to that self._getBlock(tip.hash, function(err, block) { @@ -383,6 +388,7 @@ BlockService.prototype._queueBlock = function(block) { } if (Date.now() - self._timeOfLastBestBlockReport > 30000) { // 30 seconds + self._timeOfLastBestBlockReport = Date.now(); log.info('Block Service: The best block hash is: ' + self._tip.hash + ' at height: ' + self._tip.height); }