diff --git a/lib/blocks.js b/lib/blocks.js index 69a70e6..db73b22 100644 --- a/lib/blocks.js +++ b/lib/blocks.js @@ -62,6 +62,12 @@ BlockController.prototype.checkBlockHash = function(req, res, next) { BlockController.prototype.block = function(req, res, next) { var self = this; var hash = req.params.blockHash; + + // Searching Genesis block crashes server + // Tmp handle by returning no block in index + if (hash === "0" || hash === 0) + return self.common.handleErrors(new Error('block not in index'), res); + var blockCached = self.blockCache.get(hash); if (blockCached) { @@ -73,9 +79,7 @@ BlockController.prototype.block = function(req, res, next) { self._block.getBlock(hash, function(err, block) { if (err) { return self.common.handleErrors(err, res); - } - - if (!block) { + } else if (!block) { return self.common.handleErrors(new Error('block not in index'), res); } diff --git a/package.json b/package.json index ff9163e..50854dc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "flosight-api", "description": "A Florincoin blockchain REST and web socket API service for Flocore Node.", - "version": "5.0.0-beta.64", + "version": "5.0.0-beta.65", "repository": "git://github.com/bitpay/flosight-api.git", "bugs": { "url": "https://github.com/bitpay/flosight-api/issues"