1.0.7 Commented out assertion stops
This commit is contained in:
parent
3598c92e0f
commit
453d11c64c
@ -145,7 +145,11 @@ HeaderService.prototype._adjustTipBackToCheckpoint = function() {
|
||||
|
||||
HeaderService.prototype._setGenesisBlock = function(callback) {
|
||||
|
||||
assert(this._tip.hash === this.GENESIS_HASH, 'Expected tip hash to be genesis hash, but it was not.');
|
||||
// FLOSight Error Correction from RanchiMall 17th May 2021. removed the unhandled assert and replaced by looging of error
|
||||
if (this._tip.hash != this.GENESIS_HASH) {
|
||||
log.error('Expected tip hash to be genesis hash, but it was not.');
|
||||
}
|
||||
// assert(this._tip.hash === this.GENESIS_HASH, 'Expected tip hash to be genesis hash, but it was not.');
|
||||
|
||||
var genesisHeader = {
|
||||
hash: this.GENESIS_HASH,
|
||||
@ -412,7 +416,10 @@ HeaderService.prototype._getDBOpForLastHeader = function(nextHeader) {
|
||||
this._lastHeader.nextHash = nextHeader.hash;
|
||||
var keyHash = this._encoding.encodeHeaderHashKey(this._lastHeader.hash);
|
||||
|
||||
assert(this._lastHeader.height >= 0, 'Trying to save a header with incorrect height.');
|
||||
// FLOSight Error Correction from RanchiMall 17th May 2021. removed the unhandled assert and replaced by looging of error
|
||||
if (this._lastHeader.height < 0) { log.error('Trying to save a header with incorrect height.');
|
||||
}
|
||||
// assert(this._lastHeader.height >= 0, 'Trying to save a header with incorrect height.');
|
||||
|
||||
var keyHeight = this._encoding.encodeHeaderHeightKey(this._lastHeader.height);
|
||||
var value = this._encoding.encodeHeaderValue(this._lastHeader);
|
||||
@ -466,9 +473,12 @@ HeaderService.prototype._onHeaders = function(headers) {
|
||||
for(var i = 0; i < transformedHeaders.length; i++) {
|
||||
|
||||
var header = transformedHeaders[i];
|
||||
|
||||
assert(self._lastHeader.hash === header.prevHash, 'headers not in order: ' + self._lastHeader.hash +
|
||||
' -and- ' + header.prevHash + ' Last header at height: ' + self._lastHeader.height);
|
||||
|
||||
// FLOSight Error Correction from RanchiMall 17th May 2021. removed the unhandled assert and replaced by looging of error
|
||||
if (self._lastHeader.hash != header.prevHash) {
|
||||
log.error('headers not in order: ' + self._lastHeader.hash + ' -and- ' + header.prevHash + ' Last header at height: ' + self._lastHeader.height);
|
||||
}
|
||||
// assert(self._lastHeader.hash === header.prevHash, 'headers not in order: ' + self._lastHeader.hash + ' -and- ' + header.prevHash + ' Last header at height: ' + self._lastHeader.height);
|
||||
|
||||
var ops = self._onHeader(header);
|
||||
|
||||
@ -485,9 +495,8 @@ HeaderService.prototype._onHeaders = function(headers) {
|
||||
};
|
||||
|
||||
HeaderService.prototype._handleError = function(err) {
|
||||
log.error('Header Service: ' + err);
|
||||
// FLO Crash Error Resolution by RanchiMall 10th May 2021
|
||||
// this.node.stop();
|
||||
log.error('Error in Header Service: ' + err);
|
||||
//this.node.stop();
|
||||
};
|
||||
|
||||
HeaderService.prototype._saveHeaders = function(dbOps, callback) {
|
||||
@ -778,9 +787,11 @@ HeaderService.prototype._findReorgConditionInNewPeer = function(callback) {
|
||||
|
||||
// nothing matched...
|
||||
// at this point, we should wonder if we are connected to the wrong network
|
||||
assert(true, 'We tried to find a common header between current set of headers ' +
|
||||
'and the new peer\'s set of headers, but there were none. This should be impossible ' +
|
||||
' if the new peer is using the same genesis block.');
|
||||
// FLOSight Error Correction from RanchiMall 17th May 2021. removed the unhandled assert and replaced by looging of error
|
||||
if (false) {
|
||||
log.error('We tried to find a common header between current set of headers ' + 'and the new peer\'s set of headers, but there were none. This should be impossible ' + ' if the new peer is using the same genesis block.');
|
||||
}
|
||||
// assert(true, 'We tried to find a common header between current set of headers ' +'and the new peer\'s set of headers, but there were none. This should be impossible ' +' if the new peer is using the same genesis block.');
|
||||
});
|
||||
|
||||
self._getP2PHeaders(self.GENESIS_HASH);
|
||||
@ -881,7 +892,11 @@ HeaderService.prototype._sync = function() {
|
||||
|
||||
HeaderService.prototype.getEndHash = function(tip, blockCount, callback) {
|
||||
|
||||
assert(blockCount >= 1, 'Header Service: block count to getEndHash must be at least 1.');
|
||||
// FLOSight Error Correction from RanchiMall 17th May 2021. removed the unhandled assert and replaced by looging of error
|
||||
if (blockCount < 1) {
|
||||
log.error('Header Service: block count to getEndHash must be at least 1.');
|
||||
}
|
||||
// assert(blockCount >= 1, 'Header Service: block count to getEndHash must be at least 1.');
|
||||
|
||||
var self = this;
|
||||
|
||||
@ -922,8 +937,11 @@ HeaderService.prototype.getEndHash = function(tip, blockCount, callback) {
|
||||
if (streamErr) {
|
||||
return streamErr;
|
||||
}
|
||||
|
||||
assert(results.length === numResultsNeeded, 'getEndHash returned incorrect number of results.');
|
||||
// FLOSight Error Correction from RanchiMall 17th May 2021. removed the unhandled assert and replaced by looging of error
|
||||
if (results.length != numResultsNeeded) {
|
||||
log.error('getEndHash returned incorrect number of results.');
|
||||
}
|
||||
// assert(results.length === numResultsNeeded, 'getEndHash returned incorrect number of results.');
|
||||
|
||||
var index = numResultsNeeded - 1;
|
||||
var endHash = index <= 0 || !results[index] ? 0 : results[index];
|
||||
@ -941,7 +959,11 @@ HeaderService.prototype.getEndHash = function(tip, blockCount, callback) {
|
||||
};
|
||||
|
||||
HeaderService.prototype.getLastHeader = function() {
|
||||
assert(this._lastHeader, 'Last header should be populated.');
|
||||
// FLOSight Error Correction from RanchiMall 17th May 2021. removed the unhandled assert and replaced by looging of error
|
||||
if (this._lastHeader = false) {
|
||||
log.error('Last header should be populated.'); return;
|
||||
}
|
||||
// assert(this._lastHeader, 'Last header should be populated.');
|
||||
return this._lastHeader;
|
||||
};
|
||||
|
||||
@ -998,8 +1020,14 @@ HeaderService.prototype._adjustHeadersForCheckPointTip = function(callback) {
|
||||
if (streamErr) {
|
||||
return streamErr;
|
||||
}
|
||||
|
||||
|
||||
assert(self._lastHeader, 'The last synced header was not in the database.');
|
||||
// FLOSight Error Correction from RanchiMall 17th May 2021. removed the unhandled assert and replaced by looging of error
|
||||
if (self._lastHeader = false) {
|
||||
log.error('The last synced header was not in the database.');
|
||||
}
|
||||
//assert(self._lastHeader, 'The last synced header was not in the database.');
|
||||
|
||||
self._tip.hash = self._lastHeader.hash;
|
||||
self._tip.height = self._lastHeader.height;
|
||||
self._db.batch(removalOps, callback);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user