Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

descriptor.py: fix parsing tr() desc with single leaf TREE #739

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

SomberNight
Copy link
Contributor

tr() descriptors with a single leaf TREE expression cannot be parsed currently:

>>> from hwilib.descriptor import parse_descriptor
>>> b = parse_descriptor("tr(a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd,pk(669b8afcec803a0d323e9a17f3ea8e68e8abe5a278020a929adbec52421adbd0))") 
Traceback (most recent call last):
  File "/home/user/wspace/HWI/hwilib/descriptor.py", line 437, in _get_func_expr
    end = s.rindex(")")
ValueError: substring not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/wspace/HWI/hwilib/descriptor.py", line 637, in parse_descriptor
    return _parse_descriptor(desc, _ParseDescriptorContext.TOP)
  File "/home/user/wspace/HWI/hwilib/descriptor.py", line 600, in _parse_descriptor
    subscripts.append(_parse_descriptor(sarg, _ParseDescriptorContext.P2TR))
  File "/home/user/wspace/HWI/hwilib/descriptor.py", line 527, in _parse_descriptor
    func, expr = _get_func_expr(desc)
  File "/home/user/wspace/HWI/hwilib/descriptor.py", line 440, in _get_func_expr
    raise ValueError("A matching pair of parentheses cannot be found")
ValueError: A matching pair of parentheses cannot be found

@achow101
Copy link
Member

ACK 4e8559b

@achow101 achow101 merged commit 1a129af into bitcoin-core:master Jun 24, 2024
14 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants