minor.
This commit is contained in:
parent
f065179d69
commit
4aca23e7e8
@ -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).
|
* all of the blocks in its queue).
|
||||||
* @param {Function} callback
|
* @param {Function} callback
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Chain.prototype.onFlush = function onFlush(callback) {
|
Chain.prototype.onDrain = function onDrain(callback) {
|
||||||
return this.locker.onFlush(callback);
|
return this.locker.onDrain(callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -96,7 +96,7 @@ Locker.prototype.lock = function lock(func, args, force) {
|
|||||||
|
|
||||||
if (self.add && func === self.add) {
|
if (self.add && func === self.add) {
|
||||||
if (self.pending.length === 0)
|
if (self.pending.length === 0)
|
||||||
self.emit('flush');
|
self.emit('drain');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.jobs.length === 0)
|
if (self.jobs.length === 0)
|
||||||
@ -149,19 +149,19 @@ Locker.prototype.purgePending = function purgePending() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (total !== 0)
|
if (total !== 0)
|
||||||
this.emit('flush');
|
this.emit('drain');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait for a flush (empty queue).
|
* Wait for a drain (empty queue).
|
||||||
* @param {Function} callback
|
* @param {Function} callback
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Locker.prototype.onFlush = function onFlush(callback) {
|
Locker.prototype.onDrain = function onDrain(callback) {
|
||||||
if (this.pending.length === 0)
|
if (this.pending.length === 0)
|
||||||
return callback();
|
return callback();
|
||||||
|
|
||||||
this.once('flush', callback);
|
this.once('drain', callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -54,9 +54,7 @@ function Miner(options) {
|
|||||||
this.running = false;
|
this.running = false;
|
||||||
this.timeout = null;
|
this.timeout = null;
|
||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
|
this.attempt = null;
|
||||||
this.block = null;
|
|
||||||
|
|
||||||
this.workerPool = null;
|
this.workerPool = null;
|
||||||
|
|
||||||
if (bcoin.useWorkers) {
|
if (bcoin.useWorkers) {
|
||||||
|
|||||||
@ -1650,7 +1650,7 @@ Pool.prototype.scheduleRequests = function scheduleRequests(peer) {
|
|||||||
|
|
||||||
this._scheduled = true;
|
this._scheduled = true;
|
||||||
|
|
||||||
this.chain.onFlush(function() {
|
this.chain.onDrain(function() {
|
||||||
utils.nextTick(function() {
|
utils.nextTick(function() {
|
||||||
self._sendRequests(peer);
|
self._sendRequests(peer);
|
||||||
self._scheduled = false;
|
self._scheduled = false;
|
||||||
|
|||||||
@ -3825,7 +3825,6 @@ Script.verifyProgram = function verifyProgram(witness, output, flags, tx, i) {
|
|||||||
throw new ScriptError('WITNESS_PROGRAM_WRONG_LENGTH');
|
throw new ScriptError('WITNESS_PROGRAM_WRONG_LENGTH');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bcoin.debug('Unknown witness program version: %s', program.version);
|
|
||||||
// Anyone can spend (we can return true here
|
// Anyone can spend (we can return true here
|
||||||
// if we want to always relay these transactions).
|
// if we want to always relay these transactions).
|
||||||
// Otherwise, if we want to act like an "old"
|
// Otherwise, if we want to act like an "old"
|
||||||
|
|||||||
@ -557,10 +557,7 @@ Master.prototype.debug = function debug() {
|
|||||||
|
|
||||||
args = Array.prototype.slice.call(arguments);
|
args = Array.prototype.slice.call(arguments);
|
||||||
|
|
||||||
msg = typeof args[0] !== 'object'
|
msg = utils.format(args, false);
|
||||||
? utils.format(args, false)
|
|
||||||
: args[0];
|
|
||||||
|
|
||||||
msg = utils.format(['Worker %d: %s', this.id, msg], false);
|
msg = utils.format(['Worker %d: %s', this.id, msg], false);
|
||||||
|
|
||||||
if (bcoin.isBrowser) {
|
if (bcoin.isBrowser) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user