TxBuilder: use build/buildIncomplete over boolean

This commit is contained in:
Daniel Cousens 2014-08-15 13:13:36 +10:00
parent 377b815417
commit 4e3a6c9557

View file

@ -114,7 +114,15 @@ TransactionBuilder.prototype.sign = function(index, privKey, redeemScript, hashT
assert.deepEqual(input.redeemScript, redeemScript, 'Inconsistent redeemScript') assert.deepEqual(input.redeemScript, redeemScript, 'Inconsistent redeemScript')
} }
TransactionBuilder.prototype.build = function(allowIncomplete) { TransactionBuilder.prototype.build = function() {
return this.__build(false)
}
TransactionBuilder.prototype.buildIncomplete = function() {
return this.__build(true)
}
TransactionBuilder.prototype.__build = function(allowIncomplete) {
if (!allowIncomplete) { if (!allowIncomplete) {
assert(this.tx.ins.length > 0, 'Transaction has no inputs') assert(this.tx.ins.length > 0, 'Transaction has no inputs')
assert(this.tx.outs.length > 0, 'Transaction has no outputs') assert(this.tx.outs.length > 0, 'Transaction has no outputs')