diff --git a/lib/blocks.js b/lib/blocks.js index 418beee..a534c51 100644 --- a/lib/blocks.js +++ b/lib/blocks.js @@ -211,11 +211,20 @@ BlockController.prototype._getBlockSummary = function(hash, moreTimestamp, next) var block = bcoin.block.fromRaw(blockBuffer, 'hex'); + // if we don't we a block header back, this is highly unusual, + // but possible if there was a very recent reorg and the header + // was removed but the block was not yet removed from the index. + // It is best to not return a result. self._header.getBlockHeader(hash, function(err, header) { if (err) { return next(err); } + + if (!header) { + return next(); + } + var height = header.height; var summary = {