Browse Source

enforce decodeStack receives a stack array

hk-custom-address
Daniel Cousens 7 years ago
parent
commit
8d688c39a6
  1. 1
      src/templates/multisig/input.js
  2. 1
      src/templates/pubkey/input.js
  3. 1
      src/templates/pubkeyhash/input.js
  4. 1
      src/templates/scripthash/input.js
  5. 1
      src/templates/witnesspubkeyhash/input.js
  6. 9
      src/templates/witnessscripthash/input.js

1
src/templates/multisig/input.js

@ -53,6 +53,7 @@ function encode (signatures, scriptPubKey) {
} }
function decodeStack (stack, allowIncomplete) { function decodeStack (stack, allowIncomplete) {
typeforce(typeforce.Array, stack)
typeforce(check, stack, allowIncomplete) typeforce(check, stack, allowIncomplete)
return stack.slice(1) return stack.slice(1)
} }

1
src/templates/pubkey/input.js

@ -21,6 +21,7 @@ function encode (signature) {
} }
function decodeStack (stack) { function decodeStack (stack) {
typeforce(typeforce.Array, stack)
typeforce(check, stack) typeforce(check, stack)
return stack[0] return stack[0]
} }

1
src/templates/pubkeyhash/input.js

@ -29,6 +29,7 @@ function encode (signature, pubKey) {
} }
function decodeStack (stack) { function decodeStack (stack) {
typeforce(typeforce.Array, stack)
typeforce(check, stack) typeforce(check, stack)
return { return {

1
src/templates/scripthash/input.js

@ -59,6 +59,7 @@ function encode (redeemScriptSig, redeemScript) {
} }
function decodeStack (stack) { function decodeStack (stack) {
typeforce(typeforce.Array, stack)
typeforce(check, stack) typeforce(check, stack)
return { return {

1
src/templates/witnesspubkeyhash/input.js

@ -29,6 +29,7 @@ function encodeStack (signature, pubKey) {
} }
function decodeStack (stack) { function decodeStack (stack) {
typeforce(typeforce.Array, stack)
typeforce(check, stack) typeforce(check, stack)
return { return {

9
src/templates/witnessscripthash/input.js

@ -48,11 +48,12 @@ function encodeStack (witnessData, witnessScript) {
return [].concat(witnessData, witnessScript) return [].concat(witnessData, witnessScript)
} }
function decodeStack (chunks) { function decodeStack (stack) {
typeforce(check, chunks) typeforce(typeforce.Array, stack)
typeforce(check, stack)
return { return {
witnessData: chunks.slice(0, -1), witnessData: stack.slice(0, -1),
witnessScript: chunks[chunks.length - 1] witnessScript: stack[stack.length - 1]
} }
} }

Loading…
Cancel
Save