diff --git a/lib/services/block/index.js b/lib/services/block/index.js index 305e989f..ff2f5dc4 100644 --- a/lib/services/block/index.js +++ b/lib/services/block/index.js @@ -413,7 +413,7 @@ BlockService.prototype._queueBlock = function(block) { return self._handleError(err); } - self._logSynced(block.rhash()); + self._logSynced(block.rhash(), true); self._blocksInQueue--; }); @@ -837,7 +837,7 @@ BlockService.prototype._setTip = function(tip, callback) { this._saveTip(tip, callback); }; -BlockService.prototype._logSynced = function(blockHash) { +BlockService.prototype._logSynced = function(blockHash, noHeight) { var self = this; @@ -850,13 +850,18 @@ BlockService.prototype._logSynced = function(blockHash) { async.waterfall([ function(next) { + + if (noHeight) { + next(null, null); + } + self._header.getBlockHeader(blockHash, function(err, header) { if (err) { return next(err); } if (!header) { - return next(); + return next(null, null); } blockHeight = header.height; @@ -885,8 +890,13 @@ BlockService.prototype._logSynced = function(blockHash) { return self._handleError(err); } + var supplementals = ''; + if (blockHeight && timeDiff) { + supplementals += blockHeight + '. Time between the last 2 blocks (adjusted): ' + timeDiff; + } + log.info('Block Service: The best block hash is: ' + blockHash + - ' at height: ' + blockHeight + '. Time between the last 2 blocks (adjusted): ' + timeDiff); + ' at height: ' + supplementals); });