Skip to content

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.

Notes to the reviewers

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

Changelog notice

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 80.00000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.67%. Comparing base (c5e8e84) to head (4b77231).
⚠️ Report is 23 commits behind head on master.

Files with missing lines Patch % Lines
src/wallet/mod.rs 80.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #373      +/-   ##
==========================================
+ Coverage   85.33%   86.67%   +1.33%     
==========================================
  Files          24       25       +1     
  Lines        8335     8487     +152     
==========================================
+ Hits         7113     7356     +243     
+ Misses       1222     1131      -91     
Flag Coverage Δ
rust 86.67% <80.00%> (+1.33%) ⬆️

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

luisschwab commented Jan 27, 2026

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

My mistake, the field is not pub so it's not 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
@ValuedMammal
Copy link
Collaborator

I don't have much preference about the type alias.

super nit: In 0a18206: you have formatting issues

--- a/src/wallet/mod.rs
+++ b/src/wallet/mod.rs
@@ -2320,11 +2320,9 @@ impl Wallet {
             .collect::<Vec<_>>();
 
         // Try to figure out the keychain and derivation for every input and output.
         for (is_input, index, out) in utxos.into_iter() {
-            if let Some(&(keychain, child)) =
-                self.tx_graph.index.index_of_spk(out.script_pubkey)
-            {
+            if let Some(&(keychain, child)) = self.tx_graph.index.index_of_spk(out.script_pubkey) {
                 let desc = self.public_descriptor(keychain);
                 let desc = desc
                     .at_derivation_index(child)
                     .expect("child can't be hardened");
@@ -2509,13 +2507,9 @@ impl Wallet {
             self.chain
                 .apply_header_connected_to(&block.header, height, connected_to)?
                 .into(),
         );
-        changeset.merge(
-            self.tx_graph
-                .apply_block_relevant(block, height)
-                .into(),
-        );
+        changeset.merge(self.tx_graph.apply_block_relevant(block, height).into());
         self.stage.merge(changeset);
         Ok(())
     }

@110CodingP 110CodingP changed the title refactor: rename Wallet field, add alias refactor: rename Wallet::indexed_graph field Feb 10, 2026
Copy link
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 4b77231

@ValuedMammal ValuedMammal merged commit f84cc23 into bitcoindevkit:master Feb 10, 2026
16 of 17 checks passed
@github-project-automation github-project-automation bot moved this from Needs Review to Done in BDK Wallet Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants