Fixed progress bar starting point.
This commit is contained in:
parent
d9efd7bc02
commit
57a7155265
@ -134,9 +134,6 @@ DB.prototype.start = function(callback) {
|
||||
self.genesis = Block.fromBuffer(self.bitcoind.genesisBuffer);
|
||||
self.store = levelup(self.dataPath, { db: self.levelupStore, keyEncoding: 'binary', valueEncoding: 'binary'});
|
||||
|
||||
self.node.on('stopping', function() {
|
||||
});
|
||||
|
||||
self.node.once('ready', function() {
|
||||
|
||||
self.loadTips(function(err) {
|
||||
|
||||
@ -20,7 +20,6 @@ function BlockStream(highWaterMark, db, sync) {
|
||||
this.dbTip = this.db.tip;
|
||||
this.lastReadHeight = this.dbTip.__height;
|
||||
this.lastEmittedHash = this.dbTip.hash;
|
||||
this.stopping = false;
|
||||
this.queue = [];
|
||||
this.processing = false;
|
||||
this.syncing = true;
|
||||
@ -102,9 +101,8 @@ Sync.prototype.sync = function() {
|
||||
|
||||
self.lastReportedBlock = self.db.tip.__height;
|
||||
|
||||
self.progressBar = new ProgressBar('[:bar] :percent :current blks, :blockspersec blks/sec, :elapsed secs', {
|
||||
complete: green,
|
||||
incomplete: red,
|
||||
self.progressBar = new ProgressBar('[:bar] :percent :current blks, :blockspersec blks/sec', {
|
||||
curr: self.lastReportedBlock,
|
||||
total: self.node.services.bitcoind.height,
|
||||
clear: true
|
||||
});
|
||||
@ -355,6 +353,10 @@ ProcessConcurrent.prototype._flush = function(callback) {
|
||||
WriteStream.prototype._write = function(obj, enc, callback) {
|
||||
var self = this;
|
||||
|
||||
if (self.db.node.stopping) {
|
||||
return setImmediate(callback);
|
||||
}
|
||||
|
||||
self.db.store.batch(obj.operations, function(err) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user