Browse Source

TxBuilder: avoid unnecessary assertion, already done in classification

hk-custom-address
Daniel Cousens 10 years ago
parent
commit
c7c58307f0
  1. 3
      src/transaction_builder.js

3
src/transaction_builder.js

@ -20,14 +20,13 @@ function extractInput(txIn) {
var prevOutType = scripts.classifyInput(scriptSig, true)
var scriptType
// Re-classify if P2SH
// Re-classify if scriptHash
if (prevOutType === 'scripthash') {
redeemScript = Script.fromBuffer(scriptSig.chunks.slice(-1)[0])
prevOutScript = scripts.scriptHashOutput(redeemScript.getHash())
scriptSig = Script.fromChunks(scriptSig.chunks.slice(0, -1))
scriptType = scripts.classifyInput(scriptSig, true)
assert.equal(scripts.classifyOutput(redeemScript), scriptType, 'Non-matching scriptSig and scriptPubKey in input')
} else {
scriptType = prevOutType

Loading…
Cancel
Save