transaction/builder: s/txin/txIn/g
This commit is contained in:
parent
42f2a34b8a
commit
6ed8e15b63
2 changed files with 30 additions and 30 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue