Skip to content

Commit 71c9b02

Browse files
committed
test: add P2A coverage for decodescript
1 parent 1349e9e commit 71c9b02

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/functional/rpc_decodescript.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,16 @@ def decodescript_script_pub_key(self):
187187
assert_equal('1 ' + xonly_public_key, rpc_result['asm'])
188188
assert 'segwit' not in rpc_result
189189

190+
self.log.info("- P2A (anchor)")
191+
# 1 <4e73>
192+
witprog_hex = '4e73'
193+
rpc_result = self.nodes[0].decodescript('5102' + witprog_hex)
194+
assert_equal('anchor', rpc_result['type'])
195+
# in the disassembly, the witness program is shown as single decimal due to its small size
196+
witprog_as_decimal = int.from_bytes(bytes.fromhex(witprog_hex), 'little')
197+
assert_equal(f'1 {witprog_as_decimal}', rpc_result['asm'])
198+
assert_equal('bcrt1pfeesnyr2tx', rpc_result['address'])
199+
190200
def decoderawtransaction_asm_sighashtype(self):
191201
"""Test decoding scripts via RPC command "decoderawtransaction".
192202

0 commit comments

Comments
 (0)