diff --git a/lib/bcoin/mtx.js b/lib/bcoin/mtx.js index ad3df84c..b99ac201 100644 --- a/lib/bcoin/mtx.js +++ b/lib/bcoin/mtx.js @@ -773,25 +773,26 @@ MTX.prototype.sign = function sign(index, addr, type) { * tx.addOutput({ address: ..., value: new bn(100000) }); * tx.addOutput({ address: ..., value: utils.satoshi('0.1') }); * tx.addOutput(receivingWallet, utils.satoshi('0.1')); - * @param {Wallet|Address|Object} obj - Wallet, Address, or options (see {@link Script.createOutputScript} for options). + * @param {Wallet|Address|Object} obj - Wallet, Address, + * or options (see {@link Script.createOutputScript} for options). * @param {BN?} value - Only needs to be present for non-options. */ -MTX.prototype.addOutput = function addOutput(obj, value) { +MTX.prototype.addOutput = function addOutput(address, value) { var options, output; assert(this.ts === 0, 'Cannot modify a confirmed tx.'); - if ((obj instanceof bcoin.wallet) || (obj instanceof bcoin.address)) - obj = obj.getAddress(); + if ((address instanceof bcoin.wallet) || (address instanceof bcoin.address)) + address = address.getAddress(); - if (typeof obj === 'string') { + if (typeof address === 'string') { options = { - address: obj, + address: address, value: value }; } else { - options = obj; + options = address; } output = bcoin.output(options, true); diff --git a/lib/bcoin/workers.js b/lib/bcoin/workers.js index 33256c46..245a3d7c 100644 --- a/lib/bcoin/workers.js +++ b/lib/bcoin/workers.js @@ -38,7 +38,7 @@ function Workers(options) { this.uid = 0; this.size = options.size || Workers.CORES; - this.timeout = options.timeout || -1; + this.timeout = options.timeout || 60000; this.children = []; } @@ -184,7 +184,7 @@ Workers.prototype.execute = function execute(method, args, timeout, callback) { */ Workers.prototype.verify = function verify(tx, index, force, flags, callback) { - return this.execute('verify', [tx, index, force, flags], null, callback); + return this.execute('verify', [tx, index, force, flags], -1, callback); }; /** diff --git a/lib/bcoin/writer.js b/lib/bcoin/writer.js index ae764074..22284658 100644 --- a/lib/bcoin/writer.js +++ b/lib/bcoin/writer.js @@ -339,9 +339,13 @@ BufferWriter.prototype.writeChecksum = function writeChecksum() { */ BufferWriter.prototype.fill = function fill(value, size) { + var buf; + assert(size >= 0); - var buf = new Buffer(size); + + buf = new Buffer(size); buf.fill(value); + this.written += buf.length; this.data.push(['bytes', buf]); };