rm *PushOnly, add isPushOnly and toStack
This commit is contained in:
parent
a023d23907
commit
2bb021ab64
4 changed files with 68 additions and 34 deletions
src
|
@ -145,8 +145,8 @@ function fromASM (asm) {
|
|||
}))
|
||||
}
|
||||
|
||||
function decompilePushOnly (script) {
|
||||
var chunks = decompile(script)
|
||||
function toStack (chunks) {
|
||||
chunks = decompile(chunks)
|
||||
typeforce(isPushOnly, chunks)
|
||||
|
||||
return chunks.map(function (op) {
|
||||
|
@ -157,11 +157,6 @@ function decompilePushOnly (script) {
|
|||
})
|
||||
}
|
||||
|
||||
function compilePushOnly (chunks) {
|
||||
typeforce(isPushOnly, chunks)
|
||||
return compile(chunks)
|
||||
}
|
||||
|
||||
function isCanonicalPubKey (buffer) {
|
||||
if (!Buffer.isBuffer(buffer)) return false
|
||||
if (buffer.length < 33) return false
|
||||
|
@ -196,12 +191,13 @@ module.exports = {
|
|||
decompile: decompile,
|
||||
fromASM: fromASM,
|
||||
toASM: toASM,
|
||||
compilePushOnly: compilePushOnly,
|
||||
decompilePushOnly: decompilePushOnly,
|
||||
toStack: toStack,
|
||||
|
||||
number: require('./script_number'),
|
||||
|
||||
isCanonicalPubKey: isCanonicalPubKey,
|
||||
isCanonicalSignature: isCanonicalSignature,
|
||||
isPushOnly: isPushOnly,
|
||||
isDefinedHashType: isDefinedHashType
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue