Stop the sync

Stopping the sync on header service and block service.
This commit is contained in:
sairajzero 2021-05-22 18:53:06 +05:30
parent 17dd83de10
commit 4d8d9f15a2
2 changed files with 11 additions and 0 deletions

View File

@ -1089,6 +1089,10 @@ BlockService.prototype._startSync = function() {
var numNeeded = Math.max(this._header.getLastHeader().height - this._tip.height, 0);
//Ranchimall: stop sync [Changes: adding the following 2 lines]
log.info('RM-BlockService: original numNeeded: ' + numNeeded + '. Resetting to 0')
numNeeded = 0;
//End of changes
log.info('Block Service: Gathering: ' + numNeeded + ' block(s) from the peer-to-peer network.');
if (numNeeded > 0) {

View File

@ -523,10 +523,12 @@ HeaderService.prototype._onHeadersSave = function(callback) {
self._logProgress();
/* Ranchimall: Stopping the sync [changes: commented the if block]
if (!self._syncComplete()) {
self._sync();
return callback();
}
END of changes */
self._endHeaderSubscription(); // we don't need headers any more
self._startBlockSubscription(); // we need new blocks coming tu us aynchronuously
@ -703,6 +705,11 @@ HeaderService.prototype._startSync = function() {
self._reorging = false;
var numNeeded = Math.max(self._bestHeight, self._originalHeight) - self._tip.height;
//Ranchimall: stopping sync [Changes: adding the following 3 lines
log.info('RM-HeaderService: self._tip.height: ' + self._tip.height)
log.info('RM-HeaderService: original numNeeded: ' + numNeeded +'. Resetting to 0')
numNeeded = 0;
//End of changes
// common case
if (numNeeded > 0) {
log.info('Header Service: Gathering: ' + numNeeded + ' ' + 'header(s) from the peer-to-peer network.');