Added check for missing header.
This commit is contained in:
parent
61da556645
commit
8196b1e081
@ -211,11 +211,20 @@ BlockController.prototype._getBlockSummary = function(hash, moreTimestamp, next)
|
|||||||
|
|
||||||
var block = bcoin.block.fromRaw(blockBuffer, 'hex');
|
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) {
|
self._header.getBlockHeader(hash, function(err, header) {
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!header) {
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
|
||||||
var height = header.height;
|
var height = header.height;
|
||||||
|
|
||||||
var summary = {
|
var summary = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user