Skip to content

refactor: rename Wallet field, add alias#373

Open
110CodingP wants to merge 2 commits intobitcoindevkit:masterfrom
thunderbiscuit:refactor/tx_graph
Open

refactor: rename Wallet field, add alias#373
110CodingP wants to merge 2 commits intobitcoindevkit:masterfrom
thunderbiscuit:refactor/tx_graph

Conversation

@110CodingP
Copy link
Contributor

@110CodingP 110CodingP commented Jan 27, 2026

Description

Renamed Wallet::indexed_graph to Wallet::tx_graph as the latter is a better name representing the field. Also introduced a type alias KeychainTxGraph for convenience.

Notes to the reviewers

This PR helps with the multi-keychain work being done in #318 and #367 .

Changelog notice

### Added
- Type alias `KeychainTxGraph<K>` for `IndexedTxGraph<ConfirmationBlockTime, KeychainTxOutIndex<K>>`.
### Changed
- Renamed `Wallet::indexed_graph` to `Wallet::tx_graph`.

Checklists

All Submissions:

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 77.27273% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.33%. Comparing base (c5e8e84) to head (c199d64).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/wallet/mod.rs 77.27% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #373      +/-   ##
==========================================
+ Coverage   85.33%   86.33%   +0.99%     
==========================================
  Files          24       24              
  Lines        8335     8342       +7     
==========================================
+ Hits         7113     7202      +89     
+ Misses       1222     1140      -82     
Flag Coverage Δ
rust 86.33% <77.27%> (+0.99%) ⬆️

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.

@luisschwab
Copy link
Member

@110CodingP the commit should have an ! as this is a breaking change

Copy link
Member

@thunderbiscuit thunderbiscuit left a comment

Choose a reason for hiding this comment

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

Technically it's a indexed_tx_graph. I'm guessing the shorter name is just here for brevity?

Yes I think we had chosen it for brievity, but honestly the full name works too. More important IMO is that we add the tx part, which is the heart of what the field is (it's not just a graph, it's a transaction graph).

But I also think that because the only transaction graph on the wallet is an indexed one, it's a bit redundant to call it as such, and does make intuitive sense to just call it the wallet's "transaction graph". Just semantics and bikeshedding at this point haha, so don't take my opinion too strongly.

Also I know some people consider it standard to name fields after the full type they hold, like let wallet: Wallet, so under this approach, indexed_tx_graph: IndexedTxGraph would be maybe more "correct". I just find it too much 🤣.

The type alias however... I'm not sure if it's worth the trouble. It's literally used in 1 place, so mostly just a 1-liner redirection (or misdirection?). Using the true type might be cleaner for readers/review.

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

4 participants