tests: add script.*.*.decode tests

This commit is contained in:
Daniel Cousens 2016-11-02 14:53:09 +11:00 committed by Daniel Cousens
parent 0c67f5e585
commit 9db9763221
3 changed files with 99 additions and 53 deletions
src/templates/scripthash

View file

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