diff --git a/lib/script/script.js b/lib/script/script.js index a8cb52e6..3aedf8c2 100644 --- a/lib/script/script.js +++ b/lib/script/script.js @@ -1397,8 +1397,8 @@ Script.prototype.indexOf = function indexOf(data) { }; /** - * Test a script to see if it is valid - * script code (no non-existent opcodes). + * Test a script to see if it is likely + * to be script code (no weird opcodes). * @returns {Boolean} */ @@ -1407,7 +1407,22 @@ Script.prototype.isCode = function isCode() { if (op.value === -1) return false; - if (op.value > opcodes.OP_NOP10) + if (op.isDisabled()) + return false; + + switch (op.value) { + case opcodes.OP_RESERVED: + case opcodes.OP_NOP: + case opcodes.OP_VER: + case opcodes.OP_VERIF: + case opcodes.OP_VERNOTIF: + case opcodes.OP_RESERVED1: + case opcodes.OP_RESERVED2: + case opcodes.OP_NOP1: + return false; + } + + if (op.value > opcodes.OP_NOP3) return false; }