Compare commits

...

12 Commits

Author SHA1 Message Date
sairajzero
19657aa66a configure testing parameters 2023-01-18 00:12:23 +05:30
sairajzero
816e377586 configure testing parameters 2023-01-17 23:08:45 +05:30
sairajzero
4335d6f8ce Test: adding __TestingCount log 2023-01-17 22:45:23 +05:30
sairajzero
9f72d3dd79 fix: added missing callback on testing code 2023-01-17 22:43:33 +05:30
sairajzero
269f3f1bd8 reduce MAX_IGNORED_BLOCK for testing 2023-01-17 22:20:02 +05:30
sairajzero
1fa3d45445 Adding test case and logging 2023-01-17 22:11:11 +05:30
sairajzero
ba08acb6ae remove testing-debug logging 2023-01-17 22:02:47 +05:30
Sai Raj
ca54b05618
Merge pull request #7 from ranchimall/dev2
Dev2
2023-01-17 21:56:20 +05:30
sairajzero
8c7f73b099 logging 2023-01-15 00:12:06 +05:30
Sai Raj
836f2e1f84
Merge pull request #5 from ranchimall/dev2
hotfix
2023-01-15 00:05:27 +05:30
Sai Raj
af8e939d40
Merge pull request #4 from ranchimall/dev2
test:hotfix
2023-01-11 03:41:56 +05:30
sairajzero
1a5dd8e508 debug: log peers 2023-01-10 23:22:54 +05:30

View File

@ -13,7 +13,8 @@ var bcoin = require('fcoin');
var _ = require('lodash');
var LRU = require('lru-cache');
const MAX_IGNORED_BLOCK = 32; //Maximum ignored block allowed before trigging sync again
const MAX_IGNORED_BLOCK = 5; //Maximum ignored block allowed before trigging sync again
var __TestingCount = 2;
var BlockService = function(options) {
@ -936,15 +937,25 @@ BlockService.prototype._processBlock = function(block, callback) {
log.debug('Block Service: new block: ' + block.rhash());
//Manually ignore a block for testing
__TestingCount--;
console.debug("TESTING: __TestingCount=", __TestingCount);
if(__TestingCount === 0){
console.debug("TESTING: Ignored block");
return callback();
}
// 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++;
else {
console.debug("TESTING: resync is stopped")
self._ignoredBlockCount = 0;
self._removeAllSubscriptions();
self._startSync();