Compare commits
12 Commits
master
...
dev-stash2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19657aa66a | ||
|
|
816e377586 | ||
|
|
4335d6f8ce | ||
|
|
9f72d3dd79 | ||
|
|
269f3f1bd8 | ||
|
|
1fa3d45445 | ||
|
|
ba08acb6ae | ||
|
|
ca54b05618 | ||
|
|
8c7f73b099 | ||
|
|
836f2e1f84 | ||
|
|
af8e939d40 | ||
|
|
1a5dd8e508 |
@ -13,7 +13,8 @@ var bcoin = require('fcoin');
|
|||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
var LRU = require('lru-cache');
|
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) {
|
var BlockService = function(options) {
|
||||||
|
|
||||||
@ -936,15 +937,25 @@ BlockService.prototype._processBlock = function(block, callback) {
|
|||||||
|
|
||||||
log.debug('Block Service: new block: ' + block.rhash());
|
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
|
// common case
|
||||||
if (!self._detectReorg(block)) {
|
if (!self._detectReorg(block)) {
|
||||||
return self._saveBlock(block, callback);
|
return self._saveBlock(block, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.debug("TESTING: _ignoredBlockCount=", self._ignoredBlockCount)
|
||||||
//SZ: count the ignored blocks. if many blocks ignored, trigger sync process
|
//SZ: count the ignored blocks. if many blocks ignored, trigger sync process
|
||||||
if(self._ignoredBlockCount < MAX_IGNORED_BLOCK)
|
if(self._ignoredBlockCount < MAX_IGNORED_BLOCK)
|
||||||
self._ignoredBlockCount++;
|
self._ignoredBlockCount++;
|
||||||
else {
|
else {
|
||||||
|
console.debug("TESTING: resync is stopped")
|
||||||
self._ignoredBlockCount = 0;
|
self._ignoredBlockCount = 0;
|
||||||
self._removeAllSubscriptions();
|
self._removeAllSubscriptions();
|
||||||
self._startSync();
|
self._startSync();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user