Update index.js

This commit is contained in:
tripathyr 2022-01-24 17:45:10 +05:30 committed by GitHub
parent 846f85e2f8
commit 726156843e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,7 +231,7 @@ BlockService.prototype._resetTip = function(callback) {
self._header.getAllHeaders(function(err, headers) {
if (err || !headers) {
return callback(err || log.info('headers required'));
return callback(err || log.warn('headers required'));
}
log.info('Block Service: retrieved all the headers for lookups.');
@ -277,7 +277,7 @@ BlockService.prototype._resetTip = function(callback) {
if (err || !block) {
return callback(err ||
log.info('Block Service: none of the blocks from the headers match what is already indexed in the block service.'));
log.error('Block Service: none of the blocks from the headers match what is already indexed in the block service.'));
}
self._setTip({ hash: block.rhash(), height: height + 1 }, callback);
@ -375,7 +375,7 @@ BlockService.prototype._loadRecentBlockHashes = function(callback) {
self.getBlock(hash, function(err, block) {
if (err || !block) {
return callback(err || log.info('Block Service: attempted to retrieve block: ' + hash +
return callback(err || log.error('Block Service: attempted to retrieve block: ' + hash +
' but was not in the index.'));
}
@ -415,7 +415,7 @@ BlockService.prototype._getTimeSinceLastBlock = function(callback) {
self._header.getBlockHeader(Math.max(self._tip.height - 1, 0), function(err, header) {
if(err || !header) {
return callback(err || log.info('Block Service: we should have a header in order to get time since last block.'));
return callback(err || log.error('Block Service: we should have a header in order to get time since last block.'));
}
async.map([ self._tip.hash, header.hash ], function(hash, next) {
@ -665,7 +665,7 @@ BlockService.prototype._findLatestValidBlockHeader = function(callback) {
if (self._reorgToBlock) {
return self._header.getBlockHeader(self._reorgToBlock, function(err, header) {
if (err || !header) {
return callback(err || log.info('Block Service: header not found to reorg to.'));
return callback(err || log.error('Block Service: header not found to reorg to.'));
}
callback(null, header);
});
@ -755,13 +755,13 @@ BlockService.prototype._findBlocksToRemove = function(commonHeader, callback) {
self._getBlock(hash, function(err, block) {
if (err || !block) {
return next(err || log.info('Block Service: block not found in index.'));
return next(err || log.error('Block Service: block not found in index.'));
}
self._timestamp.getTimestamp(block.rhash(), function(err, timestamp) {
if (err || !timestamp) {
return callback(err || log.info('timestamp missing from reorg.'));
return callback(err || log.error('timestamp missing from reorg.'));
}
block.__height = height;