Transaction: add comment to explain -1 on add*

This commit is contained in:
Daniel Cousens 2014-08-20 10:37:24 +10:00 committed by Daniel Cousens
parent 70be0d2117
commit b66e53d1e7

View file

@ -53,6 +53,7 @@ Transaction.prototype.addInput = function(tx, index, sequence) {
assert.equal(hash.length, 32, 'Expected hash length of 32, got ' + hash.length)
assert.equal(typeof index, 'number', 'Expected number index, got ' + index)
// Add the input and return the input's index
return (this.ins.push({
hash: hash,
index: index,
@ -78,14 +79,13 @@ Transaction.prototype.addOutput = function(scriptPubKey, value) {
// Attempt to get a valid script if it's an Address object
if (scriptPubKey instanceof Address) {
var address = scriptPubKey
scriptPubKey = address.toOutputScript()
scriptPubKey = scriptPubKey.toOutputScript()
}
assert(scriptPubKey instanceof Script, 'Expected Address or Script, got ' + scriptPubKey)
assert.equal(typeof value, 'number', 'Expected number value, got ' + value)
// Add the output and return the output's index
return (this.outs.push({
script: scriptPubKey,
value: value