You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #773: refactor expression parsing and checksum checking
eb4f8c4 expression: move checksum validation into expression parsing (Andrew Poelstra)
bb2e658 expression: add explicit well-formedness check to parser (Andrew Poelstra)
9b03043 expression: add some unit tests (Andrew Poelstra)
ad85f92 expression: implement PartialEq/Eq for trees (Andrew Poelstra)
b0508d8 checksum: clean up errors and error paths (Andrew Poelstra)
Pull request description:
As a step toward rewriting the expression parser to be non-recursive, add a pre-parsing well-formedness check, which verifies that an expression is well-formed, uses only the correct character set, and that the checksum (if present) is valid.
Along the way, replace the error types returned from the `expression` module with a new more-precise one which can identify the location of parse errors (and identify what the error was in a more correct way). This improves our error reporting and drops many instances of the stringly-typed `BadDescriptor` error.
There is currently a bunch of special logic for Taproot descriptors which have the extra characters `{` and `}`. To the extent possible, this PR doesn't touch that logic. It will be addressed in a later PR.
The benchmarks show a slight slowdown since we essentially added new validation logic without removing the old logic. Later PRs will improve things.
ACKs for top commit:
sanket1729:
ACK eb4f8c4
Tree-SHA512: cb972e9683aca51f8d18ab61521af8606f47bd1d0bc37dd1ed085101dbc4dd69b382eb05e8e21d2856ac68ebe7d2ca7879ca8a0692dacbea0b22b7b10c9ef987
let invalid_desc = format!("wpkh(tprv8ZgxMBicQKsPdpkqS7Eair4YxjcuuvDPNYmKX3sCniCf16tHEVrjjiSXEkFRnUH77yXc6ZcwHHcL{}fjdi5qUvw3VDfgYiH5mNsj5izuiu2N/1/2/*)", sparkle_heart);
0 commit comments