diff --git a/lib/script/opcode.js b/lib/script/opcode.js index 8c15e246..0317eed2 100644 --- a/lib/script/opcode.js +++ b/lib/script/opcode.js @@ -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);