Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 89f3b2a

Browse files
committed
switch from UR Output to Bytes type for Taproot Miniscript descriptors
1 parent 41708e4 commit 89f3b2a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

seedqreader.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,28 @@ def descriptor_to_output(descriptor_str):
8282
if any(op in miniscript_str for op in advanced_operators):
8383
raise ValueError(f"crypto-output does not support advanced miniscript: {miniscript_str}")
8484

85+
# Check for taproot miniscripts
86+
if hasattr(embit_desc, 'is_taproot') and embit_desc.is_taproot and embit_desc.taptree:
87+
def check_taptree_for_advanced_miniscript(tree_obj):
88+
"""Recursively check taptree for advanced miniscripts."""
89+
advanced_operators = ['or_d', 'or_c', 'or_i', 'or_b', 'and_v', 'and_b', 'and_n',
90+
'andor', 'thresh', 'older', 'after', 'sha256', 'hash256',
91+
'ripemd160', 'hash160']
92+
93+
if hasattr(tree_obj, 'miniscript') and tree_obj.miniscript is not None:
94+
miniscript_str = str(tree_obj.miniscript)
95+
if any(op in miniscript_str for op in advanced_operators):
96+
raise ValueError(f"crypto-output does not support advanced miniscript: {miniscript_str}")
97+
98+
if hasattr(tree_obj, 'tree') and tree_obj.tree is not None:
99+
if isinstance(tree_obj.tree, (list, tuple)):
100+
for item in tree_obj.tree:
101+
check_taptree_for_advanced_miniscript(item)
102+
else:
103+
check_taptree_for_advanced_miniscript(tree_obj.tree)
104+
105+
check_taptree_for_advanced_miniscript(embit_desc.taptree)
106+
85107
# Build script expressions list based on descriptor type
86108
script_expressions = []
87109
script_type = embit_desc.scriptpubkey_type()

0 commit comments

Comments
 (0)