Skip to content

Commit 83f6c0f

Browse files
committed
test: add decodescript RPC test for P2TR output type
1 parent 099c695 commit 83f6c0f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/functional/rpc_decodescript.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ def decodescript_script_pub_key(self):
176176
# a nested segwit script should not be returned in the results.
177177
assert 'segwit' not in rpc_result
178178

179+
self.log.info("- P2TR")
180+
# 1 <x-only pubkey>
181+
xonly_public_key = '01'*32 # first ever P2TR output on mainnet
182+
rpc_result = self.nodes[0].decodescript('5120' + xonly_public_key)
183+
assert_equal('witness_v1_taproot', rpc_result['type'])
184+
assert_equal('1 ' + xonly_public_key, rpc_result['asm'])
185+
assert 'segwit' not in rpc_result
186+
179187
def decoderawtransaction_asm_sighashtype(self):
180188
"""Test decoding scripts via RPC command "decoderawtransaction".
181189

0 commit comments

Comments
 (0)