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) {
|
function decodeStack (stack, allowIncomplete) {
|
||||||
|
typeforce(typeforce.Array, stack)
|
||||||
typeforce(check, stack, allowIncomplete)
|
typeforce(check, stack, allowIncomplete)
|
||||||
return stack.slice(1)
|
return stack.slice(1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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]
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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…
Reference in a new issue