TransactionBuilder: flatten prepareInput P2SH detection
This commit is contained in:
parent
a58c959099
commit
1ff64d207e
1 changed files with 3 additions and 7 deletions
|
@ -182,16 +182,12 @@ function prepareInput (input, kpPubKey, redeemScript, hashType) {
|
||||||
var expanded = expandOutput(redeemScript, undefined, kpPubKey)
|
var 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) + '"')
|
||||||
|
|
||||||
// if we don't have a prevOutScript, generate a P2SH script
|
|
||||||
if (!input.prevOutType) {
|
|
||||||
input.prevOutScript = bscript.scriptHashOutput(redeemScriptHash)
|
|
||||||
input.prevOutType = 'scripthash'
|
|
||||||
}
|
|
||||||
|
|
||||||
input.pubKeys = expanded.pubKeys
|
input.pubKeys = expanded.pubKeys
|
||||||
|
input.signatures = expanded.signatures
|
||||||
input.redeemScript = redeemScript
|
input.redeemScript = redeemScript
|
||||||
input.redeemScriptType = expanded.scriptType
|
input.redeemScriptType = expanded.scriptType
|
||||||
input.signatures = expanded.signatures
|
input.prevOutScript = input.prevOutScript || bscript.scriptHashOutput(redeemScriptHash)
|
||||||
|
input.prevOutType = 'scripthash'
|
||||||
|
|
||||||
// maybe we have some prevOut knowledge
|
// maybe we have some prevOut knowledge
|
||||||
} else if (input.prevOutType) {
|
} else if (input.prevOutType) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue