Transaction: add assertion that scriptPubKey exists

This commit is contained in:
Daniel Cousens 2014-07-11 19:18:27 +10:00
parent 56d9ea6618
commit a90a8e061e

View file

@ -84,9 +84,11 @@ Transaction.prototype.addOutput = function(scriptPubKey, value) {
scriptPubKey = address.toOutputScript() scriptPubKey = address.toOutputScript()
} }
assert(scriptPubKey instanceof Script, 'Expected Address or Script, got ' + scriptPubKey)
return (this.outs.push({ return (this.outs.push({
script: scriptPubKey, script: scriptPubKey,
value: value, value: value
}) - 1) }) - 1)
} }