remove serial sync timeout
This commit is contained in:
parent
68973b4c85
commit
c5875332d4
@ -261,11 +261,23 @@ ProcessSerial.prototype._transform = function(block, enc, callback) {
|
||||
|
||||
async.whilst(
|
||||
function() {
|
||||
return self.db.concurrentTip.__height < block.__height;
|
||||
return self.db.concurrentTip.__height < block.__height || self.db.tip.__height < block.__height - 1;
|
||||
},
|
||||
function(next) {
|
||||
var nextCalled = false;
|
||||
// wait until concurrent handler is ahead of us
|
||||
setTimeout(next, 10);
|
||||
self.db.once('addblock', function() {
|
||||
if(!nextCalled) {
|
||||
next();
|
||||
}
|
||||
nextCalled = true;
|
||||
});
|
||||
self.db.once('concurrentaddblock', function() {
|
||||
if(!nextCalled) {
|
||||
next();
|
||||
}
|
||||
nextCalled = true;
|
||||
});
|
||||
},
|
||||
function() {
|
||||
self.db.getSerialBlockOperations(block, true, function(err, operations) {
|
||||
@ -361,6 +373,7 @@ WriteStream.prototype._write = function(obj, enc, callback) {
|
||||
|
||||
if(obj.tip) {
|
||||
self.db.tip = obj.tip;
|
||||
self.db.emit('addblock');
|
||||
if(self.db.tip.__height % 100 === 0) {
|
||||
console.log('Tip:', self.db.tip.__height);
|
||||
}
|
||||
@ -368,6 +381,7 @@ WriteStream.prototype._write = function(obj, enc, callback) {
|
||||
|
||||
if(obj.concurrentTip) {
|
||||
self.db.concurrentTip = obj.concurrentTip;
|
||||
self.db.emit('concurrentaddblock');
|
||||
if(self.db.concurrentTip.__height - self.lastConcurrentOutputHeight >= 100) {
|
||||
console.log('Concurrent tip:', self.db.concurrentTip.__height);
|
||||
self.lastConcurrentOutputHeight = self.db.concurrentTip.__height;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user