templates: push only for scriptHash inputs, fixes #705

This commit is contained in:
Daniel Cousens 2016-11-14 16:17:32 +11:00 committed by Daniel Cousens
parent 03dc569236
commit 433d9f1b18

View file

@ -23,7 +23,7 @@ function check (script, allowIncomplete) {
check.toJSON = function () { return 'scriptHash input' } check.toJSON = function () { return 'scriptHash input' }
function encode (redeemScriptSig, redeemScript) { function encode (redeemScriptSig, redeemScript) {
var scriptSigChunks = bscript.decompile(redeemScriptSig) var scriptSigChunks = bscript.decompilePushOnly(redeemScriptSig)
var serializedScriptPubKey = bscript.compile(redeemScript) var serializedScriptPubKey = bscript.compile(redeemScript)
return bscript.compile([].concat( return bscript.compile([].concat(
@ -37,7 +37,7 @@ function decode (buffer) {
typeforce(check, chunks) typeforce(check, chunks)
return { return {
redeemScriptSig: bscript.compile(chunks.slice(0, -1)), redeemScriptSig: bscript.compilePushOnly(chunks.slice(0, -1)),
redeemScript: chunks[chunks.length - 1] redeemScript: chunks[chunks.length - 1]
} }
} }