Repository navigation
wallet: Follow-ups to create/load split (#32636) - #34490
davidgumberg wants to merge 3 commits into
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste 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. LLM Linter (✨ experimental)Possible typos and grammar issues:
2026-02-04 21:40:44 |
03f278e to
2f4e605
Compare
2f4e605 to
cdae75b
Compare
This addresses review comments from bitcoin#32636: - bitcoin#32636 (comment) - bitcoin#32636 (comment), - bitcoin#32636 (comment)
Previously would use global `CLIENT_VERSION` no matter what, but this is one sense a refactor since all of the places where WriteVersion is called currently call it with `CLIENT_VERSION` anyways. The `client_version` argument is kept since future test code may want to write other versions. Addresses a review comment from bitcoin#32636: bitcoin#32636 (comment)
cdae75b to
fedcd46
Compare
|
Now that #32636 is merged this can be reviewed. (soft ping @murchandamus, @enirox001, and @rkrux whose review comments are addressed in this PR) |
| * Pass-through to WalletBatch::LoadWallet() to initialize this CWallet from | ||
| * the records stored in CWallet::m_database. Primarily used by | ||
| * CWallet::LoadExisting. |
There was a problem hiding this comment.
I feel that this doesn’t answer why the method exists. I think this decorates LoadExisting with error handling, maybe that could be mentioned.
| } | ||
|
|
||
| // Make the local wallet | ||
| // Initialize the CWallet for the local wallet. |
There was a problem hiding this comment.
I think this comment is obsolete.
There was a problem hiding this comment.
Is any comment required here now?
The older comment might have been needed when CWallet::Create was called wherein it was not obvious in the caller whether the wallet would be created or loaded.
Reading CWallet::LoadExisting below seems pretty self explanatory to me.
| } | ||
|
|
||
| // Make the local wallet | ||
| // Initialize the CWallet for the local wallet. |
There was a problem hiding this comment.
Is any comment required here now?
The older comment might have been needed when CWallet::Create was called wherein it was not obvious in the caller whether the wallet would be created or loaded.
Reading CWallet::LoadExisting below seems pretty self explanatory to me.
| //! Write the given client_version. | ||
| bool WriteVersion(int client_version) { return m_batch->Write(DBKeys::VERSION, CLIENT_VERSION); } | ||
| /** | ||
| * Write the given `client_version` to #m_batch, indicating the last version |
|
|
||
| /* Initializes, creates and returns a new CWallet; returns a null pointer in case of an error */ | ||
| /** | ||
| * Create a new wallet. |
There was a problem hiding this comment.
Nit: Can mention it writes stuff to the database.
There was a problem hiding this comment.
Not sure exactly what you think would be helpful here, could you be more specific?
There was a problem hiding this comment.
- * Create a new wallet.
+ * Create a new wallet and persist in the database. So that the reader doesn't assume that the wallet is created only in memory.
I guess the function pre-split influence was still present at the time I mentioned it because for the longest time the reader was not sure if the code was creating (writing to the disk) or loading (reading from the disk) the wallet.
This suggestion can be ignored if the presence of CreateNew name makes it obvious for everyone else.
|
Concept ACK |
|
@davidgumberg can you address the comments here? |
|
Looking again, given that the changes in this PR are documentation only I'm not sure it's justified so I'll close. I apologize to reviewers who took the time to look and give feedback and whose original feedback from #32636 will be left unaddressed, but I think these comments can be improved when this area of the code is touched again, and anything in here is up for grabs. |
ec5d196 wallet: WalletBatch->WriteVersion respect argument. (David Gumberg) Pull request description: > Previously would use global `CLIENT_VERSION` no matter what, but this is one sense a refactor since all of the places where WriteVersion is called currently call it with `CLIENT_VERSION` anyways. The `client_version` argument is kept since future test code may want to write other versions. > Addresses a review comment from [#32636](#32636 (comment)): This was originally pointed out in #32636 (comment), and the followup (#34490) was never merged. However I think it's confusing to have functions that take arguments but ignore them (and it's dead code), so I've cherry-picked the fix up from #34490. ACKs for top commit: achow101: ACK ec5d196 pablomartin4btc: ACK ec5d196 w0xlt: ACK ec5d196 Tree-SHA512: 3ad82d979493ac14704975bef504c791ac72fe7910c25097f0019bf61e3d384b0e1646f90c730d2f655733428b14ccd0196c333df2d6153ff5b55ab41918a6dd
This adds documentation for
PopulateWalletFromDB()and improves documentation forLoadExisting()andCreateNew(), and makesWalletBatch::WriteVersion(int client_version)respect the argument that it's passed, addressing issues reviewers pointed in #32636.