enforce decodeStack receives a stack array
This commit is contained in:
parent
1662a391e3
commit
8d688c39a6
6 changed files with 10 additions and 4 deletions
|
@ -53,6 +53,7 @@ function encode (signatures, scriptPubKey) {
|
|||
}
|
||||
|
||||
function decodeStack (stack, allowIncomplete) {
|
||||
typeforce(typeforce.Array, stack)
|
||||
typeforce(check, stack, allowIncomplete)
|
||||
return stack.slice(1)
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ function encode (signature) {
|
|||
}
|
||||
|
||||
function decodeStack (stack) {
|
||||
typeforce(typeforce.Array, stack)
|
||||
typeforce(check, stack)
|
||||
return stack[0]
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ function encode (signature, pubKey) {
|
|||
}
|
||||
|
||||
function decodeStack (stack) {
|
||||
typeforce(typeforce.Array, stack)
|
||||
typeforce(check, stack)
|
||||
|
||||
return {
|
||||
|
|
|
@ -59,6 +59,7 @@ function encode (redeemScriptSig, redeemScript) {
|
|||
}
|
||||
|
||||
function decodeStack (stack) {
|
||||
typeforce(typeforce.Array, stack)
|
||||
typeforce(check, stack)
|
||||
|
||||
return {
|
||||
|
|
|
@ -29,6 +29,7 @@ function encodeStack (signature, pubKey) {
|
|||
}
|
||||
|
||||
function decodeStack (stack) {
|
||||
typeforce(typeforce.Array, stack)
|
||||
typeforce(check, stack)
|
||||
|
||||
return {
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue