Skip to content

Commit 8d688c3

Browse files
committedNov 30, 2017
enforce decodeStack receives a stack array
1 parent 1662a39 commit 8d688c3

File tree

6 files changed

+10
-4
lines changed

6 files changed

+10
-4
lines changed
 

‎src/templates/multisig/input.js

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ function encode (signatures, scriptPubKey) {
5353
}
5454

5555
function decodeStack (stack, allowIncomplete) {
56+
typeforce(typeforce.Array, stack)
5657
typeforce(check, stack, allowIncomplete)
5758
return stack.slice(1)
5859
}

‎src/templates/pubkey/input.js

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function encode (signature) {
2121
}
2222

2323
function decodeStack (stack) {
24+
typeforce(typeforce.Array, stack)
2425
typeforce(check, stack)
2526
return stack[0]
2627
}

‎src/templates/pubkeyhash/input.js

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function encode (signature, pubKey) {
2929
}
3030

3131
function decodeStack (stack) {
32+
typeforce(typeforce.Array, stack)
3233
typeforce(check, stack)
3334

3435
return {

‎src/templates/scripthash/input.js

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ function encode (redeemScriptSig, redeemScript) {
5959
}
6060

6161
function decodeStack (stack) {
62+
typeforce(typeforce.Array, stack)
6263
typeforce(check, stack)
6364

6465
return {

‎src/templates/witnesspubkeyhash/input.js

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function encodeStack (signature, pubKey) {
2929
}
3030

3131
function decodeStack (stack) {
32+
typeforce(typeforce.Array, stack)
3233
typeforce(check, stack)
3334

3435
return {

‎src/templates/witnessscripthash/input.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ function encodeStack (witnessData, witnessScript) {
4848
return [].concat(witnessData, witnessScript)
4949
}
5050

51-
function decodeStack (chunks) {
52-
typeforce(check, chunks)
51+
function decodeStack (stack) {
52+
typeforce(typeforce.Array, stack)
53+
typeforce(check, stack)
5354
return {
54-
witnessData: chunks.slice(0, -1),
55-
witnessScript: chunks[chunks.length - 1]
55+
witnessData: stack.slice(0, -1),
56+
witnessScript: stack[stack.length - 1]
5657
}
5758
}
5859

0 commit comments

Comments
 (0)
Please sign in to comment.