-
Notifications
You must be signed in to change notification settings - Fork 57
refactor: rename Wallet::indexed_graph field
#373
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
refactor: rename Wallet::indexed_graph field
#373
Conversation
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
My mistake, the field is not |
thunderbiscuit
left a comment
There was a problem hiding this 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.
|
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(())
} |
c199d64 to
4b77231
Compare
Wallet field, add aliasWallet::indexed_graph field
ValuedMammal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 4b77231
Description
Renamed
Wallet::indexed_graphtoWallet::tx_graphas 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
Wallet::indexed_graphtoWallet::tx_graph.Checklists
All Submissions:
just pbefore pushing