From 6ed8e15b63e39dd1e7097440a7babd1c812c0df4 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Tue, 2 Dec 2014 14:20:04 +1100 Subject: [PATCH] transaction/builder: s/txin/txIn/g --- src/transaction.js | 44 +++++++++++++++++++------------------- src/transaction_builder.js | 16 +++++++------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/transaction.js b/src/transaction.js index bc94d4e..8a40709 100644 --- a/src/transaction.js +++ b/src/transaction.js @@ -83,7 +83,7 @@ Transaction.fromHex = function(hex) { } /** - * Create a new txin. + * Create a new txIn. * * Can be called with any of: * @@ -122,7 +122,7 @@ Transaction.prototype.addInput = function(hash, index, sequence, script) { } /** - * Create a new txout. + * Create a new txOut. * * Can be called with: * @@ -156,19 +156,19 @@ Transaction.prototype.clone = function () { newTx.version = this.version newTx.locktime = this.locktime - newTx.ins = this.ins.map(function(txin) { + newTx.ins = this.ins.map(function(txIn) { return { - hash: txin.hash, - index: txin.index, - script: txin.script, - sequence: txin.sequence + hash: txIn.hash, + index: txIn.index, + script: txIn.script, + sequence: txIn.sequence } }) - newTx.outs = this.outs.map(function(txout) { + newTx.outs = this.outs.map(function(txOut) { return { - script: txout.script, - value: txout.value + script: txOut.script, + value: txOut.value } }) @@ -205,8 +205,8 @@ Transaction.prototype.hashForSignature = function(inIndex, prevOutScript, hashTy var hashScript = prevOutScript.without(opcodes.OP_CODESEPARATOR) // Blank out other inputs' signatures - txTmp.ins.forEach(function(txin) { - txin.script = Script.EMPTY + txTmp.ins.forEach(function(txIn) { + txIn.script = Script.EMPTY }) txTmp.ins[inIndex].script = hashScript @@ -280,19 +280,19 @@ Transaction.prototype.toBuffer = function () { writeUInt32(this.version) writeVarInt(this.ins.length) - this.ins.forEach(function(txin) { - writeSlice(txin.hash) - writeUInt32(txin.index) - writeVarInt(txin.script.buffer.length) - writeSlice(txin.script.buffer) - writeUInt32(txin.sequence) + this.ins.forEach(function(txIn) { + writeSlice(txIn.hash) + writeUInt32(txIn.index) + writeVarInt(txIn.script.buffer.length) + writeSlice(txIn.script.buffer) + writeUInt32(txIn.sequence) }) writeVarInt(this.outs.length) - this.outs.forEach(function(txout) { - writeUInt64(txout.value) - writeVarInt(txout.script.buffer.length) - writeSlice(txout.script.buffer) + this.outs.forEach(function(txOut) { + writeUInt64(txOut.value) + writeVarInt(txOut.script.buffer.length) + writeSlice(txOut.script.buffer) }) writeUInt32(this.locktime) diff --git a/src/transaction_builder.js b/src/transaction_builder.js index c0acb09..5e0a35f 100644 --- a/src/transaction_builder.js +++ b/src/transaction_builder.js @@ -20,26 +20,26 @@ TransactionBuilder.fromTransaction = function(transaction) { var txb = new TransactionBuilder() // Extract/add inputs - transaction.ins.forEach(function(txin) { - txb.addInput(txin.hash, txin.index, txin.sequence) + transaction.ins.forEach(function(txIn) { + txb.addInput(txIn.hash, txIn.index, txIn.sequence) }) // Extract/add outputs - transaction.outs.forEach(function(txout) { - txb.addOutput(txout.script, txout.value) + transaction.outs.forEach(function(txOut) { + txb.addOutput(txOut.script, txOut.value) }) // Extract/add signatures - transaction.ins.forEach(function(txin, i) { + transaction.ins.forEach(function(txIn, i) { // Ignore empty scripts - if (txin.script.buffer.length === 0) return + if (txIn.script.buffer.length === 0) return - assert(!Array.prototype.every.call(txin.hash, function(x) { + assert(!Array.prototype.every.call(txIn.hash, function(x) { return x === 0 }), 'coinbase inputs not supported') var redeemScript - var scriptSig = txin.script + var scriptSig = txIn.script var scriptType = scripts.classifyInput(scriptSig) // Re-classify if P2SH