refactor.
This commit is contained in:
parent
8e65b43d40
commit
efe04e528a
@ -773,25 +773,26 @@ MTX.prototype.sign = function sign(index, addr, type) {
|
|||||||
* tx.addOutput({ address: ..., value: new bn(100000) });
|
* tx.addOutput({ address: ..., value: new bn(100000) });
|
||||||
* tx.addOutput({ address: ..., value: utils.satoshi('0.1') });
|
* tx.addOutput({ address: ..., value: utils.satoshi('0.1') });
|
||||||
* tx.addOutput(receivingWallet, 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.
|
* @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;
|
var options, output;
|
||||||
|
|
||||||
assert(this.ts === 0, 'Cannot modify a confirmed tx.');
|
assert(this.ts === 0, 'Cannot modify a confirmed tx.');
|
||||||
|
|
||||||
if ((obj instanceof bcoin.wallet) || (obj instanceof bcoin.address))
|
if ((address instanceof bcoin.wallet) || (address instanceof bcoin.address))
|
||||||
obj = obj.getAddress();
|
address = address.getAddress();
|
||||||
|
|
||||||
if (typeof obj === 'string') {
|
if (typeof address === 'string') {
|
||||||
options = {
|
options = {
|
||||||
address: obj,
|
address: address,
|
||||||
value: value
|
value: value
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
options = obj;
|
options = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
output = bcoin.output(options, true);
|
output = bcoin.output(options, true);
|
||||||
|
|||||||
@ -38,7 +38,7 @@ function Workers(options) {
|
|||||||
|
|
||||||
this.uid = 0;
|
this.uid = 0;
|
||||||
this.size = options.size || Workers.CORES;
|
this.size = options.size || Workers.CORES;
|
||||||
this.timeout = options.timeout || -1;
|
this.timeout = options.timeout || 60000;
|
||||||
this.children = [];
|
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) {
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -339,9 +339,13 @@ BufferWriter.prototype.writeChecksum = function writeChecksum() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
BufferWriter.prototype.fill = function fill(value, size) {
|
BufferWriter.prototype.fill = function fill(value, size) {
|
||||||
|
var buf;
|
||||||
|
|
||||||
assert(size >= 0);
|
assert(size >= 0);
|
||||||
var buf = new Buffer(size);
|
|
||||||
|
buf = new Buffer(size);
|
||||||
buf.fill(value);
|
buf.fill(value);
|
||||||
|
|
||||||
this.written += buf.length;
|
this.written += buf.length;
|
||||||
this.data.push(['bytes', buf]);
|
this.data.push(['bytes', buf]);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user