From 4aca23e7e87bbac45f9dbab2997751b565dd6283 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 25 May 2016 04:44:28 -0700 Subject: [PATCH] minor. --- lib/bcoin/chain.js | 6 +++--- lib/bcoin/locker.js | 10 +++++----- lib/bcoin/miner.js | 4 +--- lib/bcoin/pool.js | 2 +- lib/bcoin/script.js | 1 - lib/bcoin/workers.js | 5 +---- 6 files changed, 11 insertions(+), 17 deletions(-) diff --git a/lib/bcoin/chain.js b/lib/bcoin/chain.js index 7a8e7255..f376c08b 100644 --- a/lib/bcoin/chain.js +++ b/lib/bcoin/chain.js @@ -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); }; /** diff --git a/lib/bcoin/locker.js b/lib/bcoin/locker.js index 5f76b5b4..6f30d779 100644 --- a/lib/bcoin/locker.js +++ b/lib/bcoin/locker.js @@ -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); }; /* diff --git a/lib/bcoin/miner.js b/lib/bcoin/miner.js index 2213129a..c571328c 100644 --- a/lib/bcoin/miner.js +++ b/lib/bcoin/miner.js @@ -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) { diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index 6400da66..63bc1865 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -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; diff --git a/lib/bcoin/script.js b/lib/bcoin/script.js index 894d6e05..382c56c7 100644 --- a/lib/bcoin/script.js +++ b/lib/bcoin/script.js @@ -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" diff --git a/lib/bcoin/workers.js b/lib/bcoin/workers.js index 00034748..0e2532a0 100644 --- a/lib/bcoin/workers.js +++ b/lib/bcoin/workers.js @@ -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) {