-
Notifications
You must be signed in to change notification settings - Fork 152
Commit 0010f1c
committed
Merge #804: Refactor: make descriptors::key::DescriptorKeyParseError an enum
497c5a3 refactor: make descriptors::key::DescriptorKeyParseError an enum (Chris Ricketts)
Pull request description:
This PR has a go at refactoring `DescriptorKeyParseError` into an enum, as suggested in the `FIXME` comment:
https://github.com/rust-bitcoin/rust-miniscript/blob/d0da327417cb177884c5d77edffa0891ba9b6969/src/descriptor/key.rs#L327-L330
I have separated the error variants by different inner parse error types and result types (e.g, public key, private key, etc) where I think it made sense to retain the inner error.
I left a variant that wraps a `&'static str` and its used for the various ad-hoc parsing errors instead of adding the boilerplate for variants only created once and without retained data.
The generic `parse_xkey_deriv` function now takes a parse function as its first parameter to allow specific key parsing errors:
https://github.com/chris-ricketts/rust-miniscript/blob/790b08fcf46f53ce6ee80355a7db8e5108ed860f/src/descriptor/key.rs#L935-L952
ACKs for top commit:
apoelstra:
ACK 497c5a3; successfully ran local tests; thanks!
Tree-SHA512: c9fb26b6484c90124947912070e9cca4e93b4d3bdb674a07926fb1a1adc6fe2c272a1d38925b35fc4842a527651a45b00dc6381d057bb02f36006dbda653809b
0 commit comments