Fixed premature initial sync ending.

This commit is contained in:
Chris Kleeschulte 2017-03-02 20:25:20 -05:00
parent f3e1ff0842
commit aadd336b4c

View File

@ -18,6 +18,7 @@ function BlockStream(highWaterMark, bitcoind, lastHeight) {
this.stopping = false;
this.queue = [];
this.processing = false;
this.syncing = true;
}
inherits(BlockStream, Readable);
@ -182,6 +183,7 @@ BlockStream.prototype._process = function() {
var self = this;
if (!self.syncing) {
return self.push(null);
}
@ -215,7 +217,9 @@ BlockStream.prototype._process = function() {
for(var i = 0; i < blocks.length; i++) {
self.push(blocks[i]);
if (blocks[i].hash === self.bitcoind.tip) {
self.syncing = false;
self.emit('synced');
break;
@ -296,8 +300,6 @@ ProcessSerial.prototype._process = function(block, callback) {
ProcessConcurrent.prototype._transform = function(block, enc, callback) {
var self = this;
//console.log('concurrent', block.__height);
this.lastBlock = block;
self.db.getConcurrentBlockOperations(block, true, function(err, operations) {