diff --git a/src/templates/multisig/input.js b/src/templates/multisig/input.js index 519c779..a0b2eee 100644 --- a/src/templates/multisig/input.js +++ b/src/templates/multisig/input.js @@ -53,6 +53,7 @@ function encode (signatures, scriptPubKey) { } function decodeStack (stack, allowIncomplete) { + typeforce(typeforce.Array, stack) typeforce(check, stack, allowIncomplete) return stack.slice(1) } diff --git a/src/templates/pubkey/input.js b/src/templates/pubkey/input.js index 1d34cb4..4c61664 100644 --- a/src/templates/pubkey/input.js +++ b/src/templates/pubkey/input.js @@ -21,6 +21,7 @@ function encode (signature) { } function decodeStack (stack) { + typeforce(typeforce.Array, stack) typeforce(check, stack) return stack[0] } diff --git a/src/templates/pubkeyhash/input.js b/src/templates/pubkeyhash/input.js index 0a1fe1e..ae1d758 100644 --- a/src/templates/pubkeyhash/input.js +++ b/src/templates/pubkeyhash/input.js @@ -29,6 +29,7 @@ function encode (signature, pubKey) { } function decodeStack (stack) { + typeforce(typeforce.Array, stack) typeforce(check, stack) return { diff --git a/src/templates/scripthash/input.js b/src/templates/scripthash/input.js index 16c76c0..cc5bb74 100644 --- a/src/templates/scripthash/input.js +++ b/src/templates/scripthash/input.js @@ -59,6 +59,7 @@ function encode (redeemScriptSig, redeemScript) { } function decodeStack (stack) { + typeforce(typeforce.Array, stack) typeforce(check, stack) return { diff --git a/src/templates/witnesspubkeyhash/input.js b/src/templates/witnesspubkeyhash/input.js index eacdab9..d61c426 100644 --- a/src/templates/witnesspubkeyhash/input.js +++ b/src/templates/witnesspubkeyhash/input.js @@ -29,6 +29,7 @@ function encodeStack (signature, pubKey) { } function decodeStack (stack) { + typeforce(typeforce.Array, stack) typeforce(check, stack) return { diff --git a/src/templates/witnessscripthash/input.js b/src/templates/witnessscripthash/input.js index bc2e909..d6e85f5 100644 --- a/src/templates/witnessscripthash/input.js +++ b/src/templates/witnessscripthash/input.js @@ -48,11 +48,12 @@ function encodeStack (witnessData, witnessScript) { return [].concat(witnessData, witnessScript) } -function decodeStack (chunks) { - typeforce(check, chunks) +function decodeStack (stack) { + typeforce(typeforce.Array, stack) + typeforce(check, stack) return { - witnessData: chunks.slice(0, -1), - witnessScript: chunks[chunks.length - 1] + witnessData: stack.slice(0, -1), + witnessScript: stack[stack.length - 1] } }