Skip to content

fix(descriptor): reject bare descriptors in check_wallet_descriptor#457

Open
tharu-jwd wants to merge 1 commit intobitcoindevkit:masterfrom
tharu-jwd:fix/reject-bare-descriptors
Open

fix(descriptor): reject bare descriptors in check_wallet_descriptor#457
tharu-jwd wants to merge 1 commit intobitcoindevkit:masterfrom
tharu-jwd:fix/reject-bare-descriptors

Conversation

@tharu-jwd
Copy link
Copy Markdown

Bare descriptors (e.g. pk()) have no standard address form. Passing one to the wallet wasn't caught at creation time, causing panics later when address derivation is attempted. Closes #54.

Adds UnsupportedDescriptorType to DescriptorError and checks for DescriptorType::Bare in check_wallet_descriptor, returning the new error before the descriptor reaches wallet internals.


Checklist

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

Bugfixes:

  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@ValuedMammal ValuedMammal added the api A breaking API change label Apr 24, 2026
@ValuedMammal ValuedMammal added this to the Wallet 4.0.0 milestone Apr 24, 2026
@ValuedMammal ValuedMammal moved this to In Progress in BDK Wallet Apr 24, 2026
@ValuedMammal
Copy link
Copy Markdown
Collaborator

Would you mind dropping 33fb97b and push this again with just the bare descriptor check fix, thank you.

@tharu-jwd
Copy link
Copy Markdown
Author

Would you mind dropping 33fb97b and push this again with just the bare descriptor check fix, thank you.

Hey, sure.

Bare descriptors (e.g. pk()) have no standard address form. Passing one
to the wallet would not be caught at creation time and would cause panics
later when address derivation is attempted.

Add an UnsupportedDescriptorType variant to DescriptorError and check for
DescriptorType::Bare in check_wallet_descriptor, returning the new error
before the descriptor reaches wallet internals.

Closes bitcoindevkit#54
@tharu-jwd tharu-jwd force-pushed the fix/reject-bare-descriptors branch from 7987a55 to 15604e8 Compare April 25, 2026 08:14
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 25, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.19%. Comparing base (44abb68) to head (15604e8).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
src/descriptor/error.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #457      +/-   ##
==========================================
- Coverage   80.21%   80.19%   -0.02%     
==========================================
  Files          24       24              
  Lines        5348     5353       +5     
  Branches      242      243       +1     
==========================================
+ Hits         4290     4293       +3     
- Misses        980      982       +2     
  Partials       78       78              
Flag Coverage Δ
rust 80.19% <60.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api A breaking API change

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Return error for invalid descriptor types

2 participants