Fixed issue with missing header on log entry.

This commit is contained in:
Chris Kleeschulte 2017-10-07 14:18:14 -04:00
parent d7fb9e9c27
commit aa6570d23a
No known key found for this signature in database
GPG Key ID: 33195D27EF6BDB7F
2 changed files with 14 additions and 0 deletions

View File

@ -854,11 +854,21 @@ BlockService.prototype._logSynced = function(blockHash) {
if (err) {
return next(err);
}
if (!header) {
return next();
}
blockHeight = header.height;
next(null, header.prevHash);
});
},
function(prevBlockHash, next) {
if (!prevBlockHash) {
return next();
}
self._getTimeSinceLastBlock(blockHash, prevBlockHash, function(err, diff) {
if (err) {

View File

@ -590,6 +590,10 @@ HeaderService.prototype._getHeader = function(height, hash, callback) {
return callback(new Error('invalid arguments'));
}
if (height === self._lastHeader.height || hash === self._lastHeader.hash) {
return callback(null, self._lastHeader);
}
var key;
if (hash) {
key = self._encoding.encodeHeaderHashKey(hash);