From 8623c35fc8f64b5bcc4a7782ea4cb5a8b33b73e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Haf?= Date: Sat, 5 Oct 2024 17:43:48 +0200 Subject: [PATCH] Application of the anti-inscriptions patch --- src/script/interpreter.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 9d0e9b5e3c..64ee39afca 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -479,6 +479,14 @@ bool EvalScript(std::vector >& stack, const CScript& return set_error(serror, SCRIPT_ERR_MINIMALDATA); } stack.push_back(vchPushValue); + if ((flags & SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS) && opcode == OP_FALSE) { + auto pc_tmp = pc; + opcodetype next_opcode; + valtype dummy_data; + if (script.GetOp(pc_tmp, next_opcode, dummy_data) && next_opcode == OP_IF) { + return set_error(serror, SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS); + } + } } else if (fExec || (OP_IF <= opcode && opcode <= OP_ENDIF)) switch (opcode) {