Skip to content

Properly forbid multipath keys in definite descriptor keys #830

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

Merged
merged 4 commits into from
Jul 3, 2025

Conversation

apoelstra
Copy link
Member

This PR essentially just fixes a logic bug in DefiniteDescriptorKey::new but involves several commits that just rearrange error types.

I will backport the logic fix without the error refactoring, since for 12.x and earlier we didn't really have error types and were just returning Error::Unexpected("arbitrary string") style errors.

This uses `Self::XYZ` when matching on errors, rather than writing
out the full name or using wildcard imports (which are dangerous
because the compiler may misinterpret typos as being variable
names) (although there will be a warning and CI should fail).

This also collapses a bunch of fmt impls to only write the top-level
error, in cases where we weren't adding any useful context. (We
should revisit these and produce rich errors which have line number
information and so forth; and I believe the correct way to describe
the errors is the opposite of what I've done, where we are supposed
to provide context but NOT the underlying error which can be accessed
by the .source() method. But this simplifies the code without making
things worse and we can do a proper fix later.)
sanket1729
sanket1729 previously approved these changes Jul 2, 2025
Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 5df4d5b

Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b9ccd9d

Copy link
Member Author

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On b9ccd9d successfully ran local tests

@apoelstra apoelstra merged commit 19eb66f into rust-bitcoin:master Jul 3, 2025
31 checks passed
apoelstra added a commit that referenced this pull request Jul 3, 2025
a3561f9 bump version to 12.3.3 (Andrew Poelstra)
08b446e descriptor: add unit tests for constructing multipath keys (Andrew Poelstra)
042cd08 DefiniteDescriptorKey: disallow multipath keys (Andrew Poelstra)

Pull request description:

  Just the logic fix; the error refactoring doesn't apply.


ACKs for top commit:
  sanket1729:
    utACK a3561f9


Tree-SHA512: e0ddaaa2313a791330d1bc1ca7a90604f223405b4219e66a8a840d9568a4b81789866ed80839c6e22d8453af6b5fb8cb808fc9ab2ed3a51d81df5ac14b5c626b
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