Update index.js

This commit is contained in:
tripathyr 2022-01-25 11:13:27 +05:30 committed by GitHub
parent d47b6047e5
commit af6048de93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,8 +231,8 @@ BlockService.prototype._resetTip = function(callback) {
self._header.getAllHeaders(function(err, headers) {
if (err || !headers) {
log.error(err || 'headers required');
}
log.error(err || 'headers required'); return callback(err);
}
log.info('Block Service: retrieved all the headers for lookups.');
@ -277,7 +277,7 @@ BlockService.prototype._resetTip = function(callback) {
if (err || !block) {
log.error(err ||
'Block Service: none of the blocks from the headers match what is already indexed in the block service.');
'Block Service: none of the blocks from the headers match what is already indexed in the block service.'); return callback(err);
}
self._setTip({ hash: block.rhash(), height: height + 1 }, callback);
@ -376,7 +376,7 @@ BlockService.prototype._loadRecentBlockHashes = function(callback) {
if (err || !block) {
log.error(err || 'Block Service: attempted to retrieve block: ' + hash +
' but was not in the index.');
' but was not in the index.'); return callback(err);
}
var prevHash = bcoin.util.revHex(block.prevBlock);
@ -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) {
log.error(err || 'Block Service: we should have a header in order to get time since last block.');
log.error(err || 'Block Service: we should have a header in order to get time since last block.'); return callback(err);
}
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) {
log.error(err || 'Block Service: header not found to reorg to.');
log.error(err || 'Block Service: header not found to reorg to.'); return callback(err);
}
callback(null, header);
});
@ -761,7 +761,7 @@ BlockService.prototype._findBlocksToRemove = function(commonHeader, callback) {
self._timestamp.getTimestamp(block.rhash(), function(err, timestamp) {
if (err || !timestamp) {
log.error(err || 'timestamp missing from reorg.');
log.error(err || 'timestamp missing from reorg.'); return callback(err);
}
block.__height = height;