This commit is contained in:
Christopher Jeffrey 2016-05-25 04:44:28 -07:00
parent f065179d69
commit 4aca23e7e8
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
6 changed files with 11 additions and 17 deletions

View File

@ -1303,13 +1303,13 @@ Chain.prototype.resetTime = function resetTime(ts, callback, force) {
};
/**
* Wait for the chain to flush (finish processing
* Wait for the chain to drain (finish processing
* all of the blocks in its queue).
* @param {Function} callback
*/
Chain.prototype.onFlush = function onFlush(callback) {
return this.locker.onFlush(callback);
Chain.prototype.onDrain = function onDrain(callback) {
return this.locker.onDrain(callback);
};
/**

View File

@ -96,7 +96,7 @@ Locker.prototype.lock = function lock(func, args, force) {
if (self.add && func === self.add) {
if (self.pending.length === 0)
self.emit('flush');
self.emit('drain');
}
if (self.jobs.length === 0)
@ -149,19 +149,19 @@ Locker.prototype.purgePending = function purgePending() {
});
if (total !== 0)
this.emit('flush');
this.emit('drain');
};
/**
* Wait for a flush (empty queue).
* Wait for a drain (empty queue).
* @param {Function} callback
*/
Locker.prototype.onFlush = function onFlush(callback) {
Locker.prototype.onDrain = function onDrain(callback) {
if (this.pending.length === 0)
return callback();
this.once('flush', callback);
this.once('drain', callback);
};
/*

View File

@ -54,9 +54,7 @@ function Miner(options) {
this.running = false;
this.timeout = null;
this.loaded = false;
this.block = null;
this.attempt = null;
this.workerPool = null;
if (bcoin.useWorkers) {

View File

@ -1650,7 +1650,7 @@ Pool.prototype.scheduleRequests = function scheduleRequests(peer) {
this._scheduled = true;
this.chain.onFlush(function() {
this.chain.onDrain(function() {
utils.nextTick(function() {
self._sendRequests(peer);
self._scheduled = false;

View File

@ -3825,7 +3825,6 @@ Script.verifyProgram = function verifyProgram(witness, output, flags, tx, i) {
throw new ScriptError('WITNESS_PROGRAM_WRONG_LENGTH');
}
} else {
bcoin.debug('Unknown witness program version: %s', program.version);
// Anyone can spend (we can return true here
// if we want to always relay these transactions).
// Otherwise, if we want to act like an "old"

View File

@ -557,10 +557,7 @@ Master.prototype.debug = function debug() {
args = Array.prototype.slice.call(arguments);
msg = typeof args[0] !== 'object'
? utils.format(args, false)
: args[0];
msg = utils.format(args, false);
msg = utils.format(['Worker %d: %s', this.id, msg], false);
if (bcoin.isBrowser) {