From b66e53d1e7eeaef6ef7a7805174d54c33fbf358c Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Wed, 20 Aug 2014 10:37:24 +1000 Subject: [PATCH] Transaction: add comment to explain -1 on add* --- src/transaction.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/transaction.js b/src/transaction.js index d8a0fc4..a9a0899 100644 --- a/src/transaction.js +++ b/src/transaction.js @@ -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