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 PubkeyProvider.get_pubkey_bytes for ranged desc #664

Merged
merged 1 commit into from
Feb 13, 2023

Conversation

SomberNight
Copy link
Contributor

To trigger bug:

>>> from hwilib.descriptor import parse_descriptor
>>> b = parse_descriptor("wsh(multi(1,xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/1/0/*,xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH/0/0/*))") 
>>> b.expand(3).output_script.hex()
Traceback (most recent call last):
  File "/home/user/wspace/HWI/hwilib/key.py", line 361, in parse_path
    return [str_to_harden(x) for x in n]
  File "/home/user/wspace/HWI/hwilib/key.py", line 361, in <listcomp>
    return [str_to_harden(x) for x in n]
  File "/home/user/wspace/HWI/hwilib/key.py", line 358, in str_to_harden
    return int(x)
ValueError: invalid literal for int() with base 10: '*3'

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 385, in expand
    witness_script, _, _ = self.subdescriptors[0].expand(pos)
  File "/home/user/wspace/HWI/hwilib/descriptor.py", line 340, in expand
    der_pks = [p.get_pubkey_bytes(pos) for p in self.pubkeys]
  File "/home/user/wspace/HWI/hwilib/descriptor.py", line 340, in <listcomp>
    der_pks = [p.get_pubkey_bytes(pos) for p in self.pubkeys]
  File "/home/user/wspace/HWI/hwilib/descriptor.py", line 170, in get_pubkey_bytes
    path = parse_path(path_str)
  File "/home/user/wspace/HWI/hwilib/key.py", line 363, in parse_path
    raise ValueError("Invalid BIP32 path", nstr)
ValueError: ('Invalid BIP32 path', '*3')

@achow101
Copy link
Member

ACK a1045bc

@achow101 achow101 merged commit 092cc1c into bitcoin-core:master Feb 13, 2023
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