Skip to content

Commit dec5840

Browse files
Fix duplicate keys in CODE_OPS dictionary
1 parent b189dfe commit dec5840

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

.DS_Store

6 KB
Binary file not shown.

bitcoinutils/script.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,11 @@
225225
b"\xaf": "OP_CHECKMULTISIGVERIFY",
226226
b"\xba": "OP_CHECKSIGADD", # added this new OPCODE
227227
# locktime
228-
b"\xb1": "OP_NOP2",
229-
b"\xb1": "OP_CHECKLOCKTIMEVERIFY",
230-
b"\xb2": "OP_NOP3",
231-
b"\xb2": "OP_CHECKSEQUENCEVERIFY",
228+
# Fixed duplicate keys by keeping only one mapping for each byte value
229+
# OP_NOP2 and OP_CHECKLOCKTIMEVERIFY refer to the same opcode (0xb1)
230+
b"\xb1": "OP_CHECKLOCKTIMEVERIFY", # Same as OP_NOP2
231+
# OP_NOP3 and OP_CHECKSEQUENCEVERIFY refer to the same opcode (0xb2)
232+
b"\xb2": "OP_CHECKSEQUENCEVERIFY", # Same as OP_NOP3
232233
}
233234

234235

@@ -452,4 +453,4 @@ def __repr__(self) -> str:
452453
def __eq__(self, _other: object) -> bool:
453454
if not isinstance(_other, Script):
454455
return False
455-
return self.script == _other.script
456+
return self.script == _other.script

0 commit comments

Comments
 (0)