s/checkP2shInput/checkP2SHInput

This commit is contained in:
Daniel Cousens 2017-10-19 10:52:21 +11:00
parent 1157856ab0
commit e0b227e4ef

View file

@ -254,7 +254,7 @@ function expandOutput (script, scriptType, ourPubKey) {
} }
} }
function checkP2shInput (input, redeemScriptHash) { function checkP2SHInput (input, redeemScriptHash) {
if (input.prevOutType) { if (input.prevOutType) {
if (input.prevOutType !== scriptTypes.P2SH) throw new Error('PrevOutScript must be P2SH') if (input.prevOutType !== scriptTypes.P2SH) throw new Error('PrevOutScript must be P2SH')
@ -292,7 +292,7 @@ function prepareInput (input, kpPubKey, redeemScript, witnessValue, witnessScrip
if (redeemScript && witnessScript) { if (redeemScript && witnessScript) {
redeemScriptHash = bcrypto.hash160(redeemScript) redeemScriptHash = bcrypto.hash160(redeemScript)
witnessScriptHash = bcrypto.sha256(witnessScript) witnessScriptHash = bcrypto.sha256(witnessScript)
checkP2shInput(input, redeemScriptHash) checkP2SHInput(input, redeemScriptHash)
if (!redeemScript.equals(btemplates.witnessScriptHash.output.encode(witnessScriptHash))) throw new Error('Witness script inconsistent with redeem script') if (!redeemScript.equals(btemplates.witnessScriptHash.output.encode(witnessScriptHash))) throw new Error('Witness script inconsistent with redeem script')
@ -307,7 +307,7 @@ function prepareInput (input, kpPubKey, redeemScript, witnessValue, witnessScrip
signScript = witnessScript signScript = witnessScript
} else if (redeemScript) { } else if (redeemScript) {
redeemScriptHash = bcrypto.hash160(redeemScript) redeemScriptHash = bcrypto.hash160(redeemScript)
checkP2shInput(input, redeemScriptHash) checkP2SHInput(input, redeemScriptHash)
expanded = expandOutput(redeemScript, undefined, kpPubKey) expanded = expandOutput(redeemScript, undefined, kpPubKey)
if (!expanded.pubKeys) throw new Error('RedeemScript not supported "' + bscript.toASM(redeemScript) + '"') if (!expanded.pubKeys) throw new Error('RedeemScript not supported "' + bscript.toASM(redeemScript) + '"')