From 1fa3d454451dc4b3d6e9d690ff631f17da495f60 Mon Sep 17 00:00:00 2001 From: sairajzero Date: Tue, 17 Jan 2023 22:11:11 +0530 Subject: [PATCH] Adding test case and logging --- lib/services/block/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/services/block/index.js b/lib/services/block/index.js index da34ad59..9a66e382 100644 --- a/lib/services/block/index.js +++ b/lib/services/block/index.js @@ -14,6 +14,7 @@ var _ = require('lodash'); var LRU = require('lru-cache'); const MAX_IGNORED_BLOCK = 32; //Maximum ignored block allowed before trigging sync again +var __TestingCount = 5; var BlockService = function(options) { @@ -936,11 +937,17 @@ BlockService.prototype._processBlock = function(block, callback) { log.debug('Block Service: new block: ' + block.rhash()); + //Manually ignore a block for testing + __TestingCount--; + if(__TestingCount === 0) + return console.debug("TESTING: Ignored block"); + // common case if (!self._detectReorg(block)) { return self._saveBlock(block, callback); } + console.debug("TESTING: _ignoredBlockCount=", self._ignoredBlockCount) //SZ: count the ignored blocks. if many blocks ignored, trigger sync process if(self._ignoredBlockCount < MAX_IGNORED_BLOCK) self._ignoredBlockCount++;