Skip to content

Commit 4dd9ca7

Browse files
committed
Transaction: add comment to explain -1 on add*
1 parent 70be0d2 commit 4dd9ca7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/transaction.js

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Transaction.prototype.addInput = function(tx, index, sequence) {
5353
assert.equal(hash.length, 32, 'Expected hash length of 32, got ' + hash.length)
5454
assert.equal(typeof index, 'number', 'Expected number index, got ' + index)
5555

56+
// Add the input, and return the input's index from Array.push
5657
return (this.ins.push({
5758
hash: hash,
5859
index: index,
@@ -86,6 +87,7 @@ Transaction.prototype.addOutput = function(scriptPubKey, value) {
8687
assert(scriptPubKey instanceof Script, 'Expected Address or Script, got ' + scriptPubKey)
8788
assert.equal(typeof value, 'number', 'Expected number value, got ' + value)
8889

90+
// Add the output, and return the output's index from Array.push
8991
return (this.outs.push({
9092
script: scriptPubKey,
9193
value: value

0 commit comments

Comments
 (0)