TransactionBuilder: expandInput, consistent variable names
This commit is contained in:
parent
f3cc71a75f
commit
0e2480523a
1 changed files with 5 additions and 8 deletions
|
@ -11,15 +11,14 @@ var ECPair = require('./ecpair')
|
||||||
var ECSignature = require('./ecsignature')
|
var ECSignature = require('./ecsignature')
|
||||||
var Transaction = require('./transaction')
|
var Transaction = require('./transaction')
|
||||||
|
|
||||||
// inspects a scriptSig w/ optional provided redeemScript and derives
|
// inspects a scriptSig w/ optional redeemScript and
|
||||||
// all necessary input information as required by TransactionBuilder
|
// derives any input information required
|
||||||
function expandInput (scriptSig, redeemScript) {
|
function expandInput (scriptSig, redeemScript) {
|
||||||
var scriptSigChunks = bscript.decompile(scriptSig)
|
var scriptSigChunks = bscript.decompile(scriptSig)
|
||||||
var scriptSigType = bscript.classifyInput(scriptSigChunks, true)
|
var prevOutType = bscript.classifyInput(scriptSigChunks, true)
|
||||||
|
|
||||||
var hashType, pubKeys, signatures, prevOutScript
|
var hashType, pubKeys, signatures, prevOutScript
|
||||||
|
|
||||||
switch (scriptSigType) {
|
switch (prevOutType) {
|
||||||
case 'scripthash':
|
case 'scripthash':
|
||||||
// FIXME: maybe depth limit instead, how possible is this anyway?
|
// FIXME: maybe depth limit instead, how possible is this anyway?
|
||||||
if (redeemScript) throw new Error('Recursive P2SH script')
|
if (redeemScript) throw new Error('Recursive P2SH script')
|
||||||
|
@ -42,7 +41,6 @@ function expandInput (scriptSig, redeemScript) {
|
||||||
signatures = [s.signature]
|
signatures = [s.signature]
|
||||||
|
|
||||||
if (redeemScript) break
|
if (redeemScript) break
|
||||||
|
|
||||||
prevOutScript = bscript.pubKeyHashOutput(bcrypto.hash160(pubKeys[0]))
|
prevOutScript = bscript.pubKeyHashOutput(bcrypto.hash160(pubKeys[0]))
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -74,7 +72,6 @@ function expandInput (scriptSig, redeemScript) {
|
||||||
|
|
||||||
return sss.signature
|
return sss.signature
|
||||||
})
|
})
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +80,7 @@ function expandInput (scriptSig, redeemScript) {
|
||||||
pubKeys: pubKeys,
|
pubKeys: pubKeys,
|
||||||
signatures: signatures,
|
signatures: signatures,
|
||||||
prevOutScript: prevOutScript,
|
prevOutScript: prevOutScript,
|
||||||
prevOutType: scriptSigType
|
prevOutType: prevOutType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue