bips icon indicating copy to clipboard operation
bips copied to clipboard

chore: improve key parsing logic and fix premature termination issues

Open famouswizard opened this issue 2 months ago • 0 comments

fixed several parsing bugs in key handling logic:

  • find_key_end_position: removed '/' from the set of terminating characters. This prevents derivation paths like .../44'/0'/0'/... from being truncated at the first /.
  • parse_key_expressions: implemented proper parenthesis depth tracking for musig(...) expressions instead of stopping at the first ), allowing correct parsing of nested expressions.
  • parse_key_expressions: added boundary checks (key_pos_end < len(descriptor)) before indexing descriptor[key_pos_end] to avoid IndexError at string ends.

these changes ensure the parser correctly handles complex key expressions and avoids crashes on edge cases.

famouswizard avatar Oct 18 '25 11:10 famouswizard