From 22a879f154639969909ac65cf5df81f72ebfb902 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 24 Aug 2017 22:24:39 -0700 Subject: [PATCH] opcode: fix uncatchable error on .equals(). --- lib/script/opcode.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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);