-
Notifications
You must be signed in to change notification settings - Fork 38.8k
refactor: Remove gArgs from wallet.h and wallet.cpp (2)
#22928
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
Conversation
gArgs from wallet.h and wallet.cpp (2)gArgs from wallet.h and wallet.cpp (2)
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
ryanofsky
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.
Code review ACK d7b9045, but I left two review comments below that would be good to address.
Also it would be good if PR description linked to issue #21005 as the true motivation for this PR, instead of saying that I suggested this. I think the current description which says the PR "follows the suggestion by ryanofsky" is a misleading, even though it is technically true, because I don't have any opinion on whether gArgs should be removed from wallet code, and I didn't suggest doing that. My suggestions have only been about how to pass ArgsManager references if you did decide it was important to get rid of gArgs.
src/wallet/test/ismine_tests.cpp
Outdated
| // P2PK compressed | ||
| { | ||
| CWallet keystore(chain.get(), "", CreateDummyWalletDatabase()); | ||
| CWallet keystore(chain.get(), "", gArgs, CreateDummyWalletDatabase()); |
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.
In commit "Remove gArgs from wallet.h and wallet.cpp" (d7b9045)
I think it's mistake to be adding gArgs references so many places when the goal is to not use gArgs. Most of these uses can be replaced by m_args. Would suggest the following change:
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.
Thank you for the feedback! My approach overall is to progress from the bottom up. I find the way I did it here very conservative so that we are sure that nothing breaks. You are right that m_args can be used here, I wanted to do that later but if you find it better use m_args right away, then great.
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.
Thanks! Normally I'd agree with being incremental and conservative, but if it is important to do this transition away from gArgs I think it is also important to try to make transition painless as possible to reviewers, and to other PR authors working on conflicting PRs by avoiding changing the same code multiple times in multiple PRs.
Maybe changing the same code in different PRs makes sense if one change is a bulk change and the second change is a manual change. But if two changes are both bulk changes, then splitting into conservative and non-conservative PRs just delays the inevitable non-conservative part of the change and prolongs the transition for no benefit. Also, these are changes to test code so there is basically no need to be conservative because it will be obvious if the tests are broken.
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.
In general it would be great to be to see a consolidated final PR with all the future changes in one place. Or if that is too much work, it would be good to have a roadmap describing what the future changes will be. At very least if a PR has changes that are known to be temporary, it would be good to identify which parts of the PR are temporary, and which parts are permanent in the PR description.
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.
Makes sense. I'll see what I can do.
d7b9045 to
8762663
Compare
Sorry for putting words to your mouth 😐 |
ryanofsky
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.
Code review ACK 8762663a31727d7fce578dff6c3a02307b59a967. Only changes since previous review were removing gArgs usages in tests and simplifying AttachChain arguments.
Sorry for putting words to your mouth
Sorry that was my fault. You referenced the post correctly. I just didn't make the context clear that it was an "if you need to do this" change suggestion, not a change request!
8762663 to
5b0d937
Compare
5b0d937 to
d815b50
Compare
ryanofsky
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.
Code review ACK d815b50edc057424b09e4310543904f28f0f6dd2. No changes since last review other than rebase
d815b50 to
29554af
Compare
ryanofsky
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.
Code review ACK 29554afb7305c8ff2d262ca78e61a67e10615427. No changes since last review other than rebase
|
🙏 |
src/wallet/wallet.cpp
Outdated
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.
This hunk can be removed via a rebase
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.
You are right. I have rebased the PR. Thanks.
Co-authored-by: Russell Yanofsky <[email protected]>
29554af to
2ec38bd
Compare
ryanofsky
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.
Code review ACK 2ec38bd. No changes since last review, just rebase
| NodeContext node; | ||
| auto chain = interfaces::MakeChain(node); | ||
| CWallet wallet(chain.get(), "", CreateDummyWalletDatabase()); | ||
| CWallet wallet(chain.get(), "", gArgs, CreateDummyWalletDatabase()); |
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.
Can't this use node.args directly? (Same for all instances below)
This is a follow-up PR to #22183 and is related to #21005 issue.