script: use asMinimalOP for ASM/decompile
This commit is contained in:
parent
152eed57a0
commit
e7c59c4b8b
3 changed files with 31 additions and 23 deletions
test
|
@ -24,7 +24,6 @@ describe('script', function () {
|
|||
fixtures.valid.forEach(function (f) {
|
||||
it('encodes/decodes ' + f.asm, function () {
|
||||
var scriptSig = bscript.fromASM(f.asm)
|
||||
|
||||
assert.strictEqual(bscript.toASM(scriptSig), f.asm)
|
||||
})
|
||||
})
|
||||
|
@ -52,17 +51,16 @@ describe('script', function () {
|
|||
describe('toStack', function () {
|
||||
fixtures.valid.forEach(function (f) {
|
||||
it('returns ' + !!f.stack + ' for ' + f.asm, function () {
|
||||
if (!f.stack || !f.asm) return
|
||||
|
||||
var script = bscript.fromASM(f.asm)
|
||||
|
||||
if (f.stack && f.asm) {
|
||||
try {
|
||||
var stack = bscript.toStack(script)
|
||||
assert.deepEqual(stack.map(function (x) { return x.toString('hex') }), f.stack)
|
||||
assert.equal(bscript.toASM(bscript.compile(stack)), f.asm, 'should rebuild same script from stack')
|
||||
} catch (e) {
|
||||
assert.strictEqual(f.stack, undefined)
|
||||
}
|
||||
}
|
||||
var stack = bscript.toStack(script)
|
||||
assert.deepEqual(stack.map(function (x) {
|
||||
return x.toString('hex')
|
||||
}), f.stack)
|
||||
|
||||
assert.equal(bscript.toASM(bscript.compile(stack)), f.asm, 'should rebuild same script from stack')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue