opcode: fix uncatchable error on .equals().

This commit is contained in:
Christopher Jeffrey 2017-08-24 22:24:39 -07:00
parent f1ac30a6c1
commit 22a879f154
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -429,9 +429,6 @@ Opcode.fromOp = function fromOp(op) {
Opcode.fromData = function fromData(data) {
assert(Buffer.isBuffer(data));
if (data.length === 0)
return Opcode.fromOp(opcodes.OP_0);
if (data.length === 1) {
if (data[0] >= 1 && data[0] <= 16)
return Opcode.fromOp(data[0] + 0x50);
@ -454,6 +451,9 @@ Opcode.fromData = function fromData(data) {
Opcode.fromPush = function fromPush(data) {
assert(Buffer.isBuffer(data));
if (data.length === 0)
return Opcode.fromOp(opcodes.OP_0);
if (data.length <= 0x4b)
return new Opcode(data.length, data);