Skip to content

Commit a93da8b

Browse files
authored
Merge pull request #116 from JAGADISHSUNILPEDNEKAR/feature/add-checksigadd-opcode
Add OP_CHECKSIGADD opcode support for Taproot script paths
2 parents 1945527 + f36719c commit a93da8b

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

bitcoinutils/script.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,13 @@
126126
"OP_CHECKSIGVERIFY": b"\xad",
127127
"OP_CHECKMULTISIG": b"\xae",
128128
"OP_CHECKMULTISIGVERIFY": b"\xaf",
129+
"OP_CHECKSIGADD": b"\xba", # added this new OPCODE
129130
# locktime
130131
"OP_NOP2": b"\xb1",
131132
"OP_CHECKLOCKTIMEVERIFY": b"\xb1",
132133
"OP_NOP3": b"\xb2",
133134
"OP_CHECKSEQUENCEVERIFY": b"\xb2",
135+
134136
}
135137

136138
CODE_OPS = {
@@ -221,6 +223,7 @@
221223
b"\xad": "OP_CHECKSIGVERIFY",
222224
b"\xae": "OP_CHECKMULTISIG",
223225
b"\xaf": "OP_CHECKMULTISIGVERIFY",
226+
b"\xba": "OP_CHECKSIGADD", # added this new OPCODE
224227
# locktime
225228
b"\xb1": "OP_NOP2",
226229
b"\xb1": "OP_CHECKLOCKTIMEVERIFY",

tests/test_checksigadd.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import unittest
2+
from bitcoinutils.script import Script
3+
4+
class TestCheckSigAdd(unittest.TestCase):
5+
def test_checksigadd_opcode(self):
6+
# Create a script with the new opcode
7+
script = Script(["OP_CHECKSIGADD"])
8+
# Check if it serializes correctly to hex
9+
self.assertEqual(script.to_hex(), "ba")
10+
11+
if __name__ == "__main__":
12+
unittest.main()

0 commit comments

Comments
 (0)