1.0.8 Commented out assertion stops

This commit is contained in:
Vivek Teega 2021-05-17 13:37:19 +05:30
parent 453d11c64c
commit 56e5cb1f25

View File

@ -258,7 +258,12 @@ BlockService.prototype._resetTip = function(callback) {
block = _block;
header = headers.getIndex(--height);
assert(header, 'Header not found for reset.');
// FLOSight Error Correction from RanchiMall 17th May 2021. removed the unhandled assert and replaced by looging of error
if (header = false) {
log.error('Header not found for reset.');
}
// assert(header, 'Header not found for reset.');
if (!block) {
log.debug('Block Service: trying block: ' + header.hash);
@ -387,7 +392,11 @@ BlockService.prototype._loadRecentBlockHashes = function(callback) {
return callback(err);
}
assert(self._recentBlockHashes.length === times, 'Block Service: did not load enough recent block hashes from the index.');
// FLOSight Error Correction from RanchiMall 17th May 2021. removed the unhandled assert and replaced by looging of error
if (self._recentBlockHashes.length != times) {
log.error('Block Service: did not load enough recent block hashes from the index.');
}
//assert(self._recentBlockHashes.length === times, 'Block Service: did not load enough recent block hashes from the index.');
log.info('Block Service: loaded: ' + self._recentBlockHashes.length + ' hashes from the index.');
callback();
@ -711,11 +720,16 @@ BlockService.prototype._findLatestValidBlockHeader = function(callback) {
// any of our recent block hashes in its indexes.
// if some joker mines a block using an orphan block as its prev block, then the effect of this will be
// us detecting a reorg, but not actually reorging anything
assert(header, 'Block Service: we could not locate any of our recent block hashes in the header service ' +
'index. Perhaps our header service sync\'ed to the wrong chain?');
// FLOSight Error Correction from RanchiMall 17th May 2021. removed the unhandled assert and replaced by looging of error
if (header = false) {
log.error('Block Service: we could not locate any of our recent block hashes in the header service ' + 'index. Perhaps our header service sync\'ed to the wrong chain?');
}
// assert(header, 'Block Service: we could not locate any of our recent block hashes in the header service ' + 'index. Perhaps our header service sync\'ed to the wrong chain?');
assert(header.height <= self._tip.height, 'Block Service: we found a common ancestor header whose ' +
'height was greater than our current tip. This should be impossible.');
if (header.height > self._tip.height) {
log.error('Block Service: we found a common ancestor header whose ' + 'height was greater than our current tip. This should be impossible.');
}
// assert(header.height <= self._tip.height, 'Block Service: we found a common ancestor header whose ' + 'height was greater than our current tip. This should be impossible.');
callback(null, header);
@ -815,8 +829,10 @@ BlockService.prototype._handleReorg = function(callback) {
blocksToRemove = _blocksToRemove;
assert(blocksToRemove.length >= 1 && blocksToRemove.length <= self._recentBlockHashes.length,
'Block Service: the number of blocks to remove looks to be incorrect.');
// FLOSight Error Correction from RanchiMall 17th May 2021. removed the unhandled assert and replaced by looging of error
if (blocksToRemove.length < 1 || blocksToRemove.length > self._recentBlockHashes.length) {
log.error('Block Service: the number of blocks to remove looks to be incorrect.'); }
// assert(blocksToRemove.length >= 1 && blocksToRemove.length <= self._recentBlockHashes.length, 'Block Service: the number of blocks to remove looks to be incorrect.');
log.warn('Block Service: chain reorganization detected, current height/hash: ' + self._tip.height + '/' +
self._tip.hash + ' common ancestor hash: ' + commonAncestorHeader.hash + ' at height: ' + commonAncestorHeader.height +