Skip to content

Refactor: Move Wallet errors into their dedicated file#378

Merged
ValuedMammal merged 1 commit intobitcoindevkit:masterfrom
thunderbiscuit:refactor/wallet-module
Feb 9, 2026
Merged

Refactor: Move Wallet errors into their dedicated file#378
ValuedMammal merged 1 commit intobitcoindevkit:masterfrom
thunderbiscuit:refactor/wallet-module

Conversation

@thunderbiscuit
Copy link
Copy Markdown
Member

The src/wallet/mod.rs is currently a very big file (3200 lines exactly), and over the course of my work on #318 I noticed a few small refactors that could help keep things tidy (ok it's a drop in the bucket but still a win!) and reduce the line count a bit.

Notes to the reviewers

We had 3 wallet-related errors that were defined in the mod.rs file, but we also have a dedicated error.rs file which states:

//! Errors that can be thrown by the `Wallet`

The errors belong there in my opinion, and this is a small refactor moving them over.

Changelog notice

No changelog required.

Checklists

All Submissions:

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 6, 2026

Codecov Report

❌ Patch coverage is 0% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.46%. Comparing base (35502e0) to head (a9bfdbc).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
src/wallet/error.rs 0.00% 45 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #378   +/-   ##
=======================================
  Coverage   86.46%   86.46%           
=======================================
  Files          25       25           
  Lines        8527     8527           
=======================================
  Hits         7373     7373           
  Misses       1154     1154           
Flag Coverage Δ
rust 86.46% <0.00%> (ø)

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.

@ValuedMammal ValuedMammal moved this to Needs Review in BDK Wallet Feb 6, 2026
@ValuedMammal ValuedMammal added this to the Wallet 3.0.0 milestone Feb 6, 2026
@thunderbiscuit
Copy link
Copy Markdown
Member Author

It's weird because it's a clean move of the types, no new code, but the codecov tool treats it as new code and finds it has 0% coverage.

@ValuedMammal
Copy link
Copy Markdown
Collaborator

Also we're not using ApplyBlockError at all it seems.

Copy link
Copy Markdown
Collaborator

@ValuedMammal ValuedMammal left a comment

Choose a reason for hiding this comment

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

ACK a9bfdbc

I tested by replicating the move and found no significant differences.

@ValuedMammal ValuedMammal merged commit c2d0850 into bitcoindevkit:master Feb 9, 2026
17 of 18 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in BDK Wallet Feb 9, 2026
ValuedMammal added a commit that referenced this pull request Feb 17, 2026
20fea22 refactor: remove unused ApplyBlockError (thunderbiscuit)

Pull request description:

  This was caught by ValuedMammal here: #378 (comment)

  ### Description

  This PR removes an unused error.

  An alternative could be to repurpose the type to be used as the error for the `apply_block*` methods, as it seems to be adequately named to go along with `Wallet::apply_block`.

  ### Changelog notice

  - Removed `ApplyBlockError` from the public API

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `just p` before pushing

  #### New Features:

  * [ ] I've added tests for the new feature
  * [ ] I've added docs for the new feature

  #### Bugfixes:

  * [x] This pull request breaks the existing API
  * [ ] I've added tests to reproduce the issue which are now passing
  * [ ] I'm linking the issue being fixed by this PR

ACKs for top commit:
  luisschwab:
    ACK 20fea22
  evanlinjin:
    ACK 20fea22
  110CodingP:
    ACK [20fea22](20fea22)

Tree-SHA512: 964ca874cce8778a7ca72a9bcc438894a9a422fd688ba9fbf61e580357e322dd05f17ee0c6ebedb746597342b6983d150120a32ce267418b7622f7960255ff63
@ValuedMammal ValuedMammal mentioned this pull request Mar 4, 2026
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants