Skip to content

Commit e7b4bba

Browse files
committed
Update OP_SUCCESS for elements with allowed opcodes
1 parent 022f211 commit e7b4bba

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/script/script.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,10 @@ bool GetScriptOp(CScriptBase::const_iterator& pc, CScriptBase::const_iterator en
411411

412412
bool IsOpSuccess(const opcodetype& opcode)
413413
{
414-
return opcode == 80 || opcode == 98 || (opcode >= 126 && opcode <= 129) ||
415-
(opcode >= 131 && opcode <= 134) || (opcode >= 137 && opcode <= 138) ||
416-
(opcode >= 141 && opcode <= 142) || (opcode >= 149 && opcode <= 153) ||
417-
(opcode >= 187 && opcode <= 254);
414+
// ELEMENTS: Don't mark opcodes (OP_CAT, OP_SUBSTR, OP_LEFT, OP_RIGHT) as OP_SUCCESS
415+
return opcode == 80 || opcode == 98 || (opcode >= 137 && opcode <= 138) ||
416+
// ELEMENTS: Don't mark OP_INVERT , OP_AND, OP_OR, OP_XOR. OP_LSHIFT, OP_RSHIFT as success
417+
(opcode >= 141 && opcode <= 142) || (opcode >= 149 && opcode <= 151) ||
418+
// ELEMENTS: Exclude OP_DETERMINISTICRANDOM, OP_CHECKSIGFROMSTACK(VERIFY), OP_SUBSTRLAZY
419+
(opcode >= 187 && opcode <= 191) || (opcode >= 196 && opcode <= 254);
418420
}

test/functional/test_framework/script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,4 +921,4 @@ def taproot_construct(pubkey, scripts=None):
921921
return TaprootInfo(CScript([OP_1, tweaked]), pubkey, negated + 0, tweak, leaves)
922922

923923
def is_op_success(o):
924-
return o == 0x50 or o == 0x62 or o == 0x89 or o == 0x8a or o == 0x8d or o == 0x8e or (o >= 0x7e and o <= 0x81) or (o >= 0x83 and o <= 0x86) or (o >= 0x95 and o <= 0x99) or (o >= 0xbb and o <= 0xfe)
924+
return o == 80 or o == 98 or (o >= 137 and o <= 138) or (o >= 141 and o <= 142) or (o >= 149 and o <= 151) or (o >= 187 and o <= 191) or (o >= 196 and o <= 254)

0 commit comments

Comments
 (0)