Added check for missing header.

This commit is contained in:
Chris Kleeschulte 2017-10-10 09:27:50 -04:00
parent 61da556645
commit 8196b1e081
No known key found for this signature in database
GPG Key ID: 33195D27EF6BDB7F

View File

@ -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 = {