-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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
Remove wallet.dat path handling from wallet.cpp, rpcwallet.cpp #19619
Conversation
Concept ACK. |
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. |
Could the second commit be split up a bit? It seems to be doing a lot and several functions are being renamed and removed. From what I understand, the second commit adds From this, I think you could add a few more commits:
|
Sure, I think I can split up like you're suggesting. The main change is introducing the |
I can see why we'd want to move anything about "wallet.dat" or the "wallet is a directory" stuff into the database layer, but IMO it doesn't make sense to hide the path the wallet is located within... |
Concept ACK, as a logical separation I think it makes sense to have database-format-specific stuff like this at a lower layer than the logical use of a generic database in the rest of the code. |
ACK 83a8f51 |
This removes a source of complexity and indirection that makes it harder to understand path checking code. Path checks will be simplified in upcoming commits. There is no change in behavior in this commit other than a slightly more descriptive error message in `loadwallet` if the default "" wallet can't be found. (The error message is improved more in upcoming commit "wallet: Remove path checking code from loadwallet RPC".)
New function is not currently called but will be called in upcoming commits. It moves database path checking, and existence checking, and already-loaded checking, and verification into a single function so this logic does not need to be repeated all over higher level wallet code, and so higher level code does not need to change when SQLite support is added in bitcoin#19077. This also lets higher level wallet code make fewer assumptions about the contents of wallet directories. This commit just adds the new function and does not change behavior in any way.
No changes in behavior. Just replaces arguments and return types
Checks are now consolidated in MakeBerkeleyDatabase function instead of happening in higher level code. This commit does not change behavior except for error messages which now include more complete information.
No changes in behavior
This commit does not change behavior except for error messages which now include more complete information.
This commit does not change behavior except for error messages which now include more complete information.
This commit does not change behavior except for error messages which now include more complete information.
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 83a8f51, tested on Linux Mint 20 (x86_64).
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.
src/wallet/rpcwallet.cpp
Outdated
if (!location.Exists()) { | ||
throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Wallet " + location.GetName() + " not found."); | ||
} else if (fs::is_directory(location.GetPath())) { | ||
if (fs::symlink_status(path).type() == fs::file_not_found) { |
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.
I sort of liked that the functionality was wrapped in one function. This avoids issues exactly like this
Replied #19619 (review)
ACK 7bf6dfb |
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.
re-ACk 7bf6dfb
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 re-review and functional test run ACK 7bf6dfb
… rpcwallet.cpp 7bf6dfb wallet: Remove path checking code from bitcoin-wallet tool (Russell Yanofsky) 77d5bb7 wallet: Remove path checking code from createwallet RPC (Russell Yanofsky) a987438 wallet: Remove path checking code from loadwallet RPC (Russell Yanofsky) 8b5e729 refactor: Pass wallet database into CWallet::Create (Russell Yanofsky) 3c815cf wallet: Remove Verify and IsLoaded methods (Russell Yanofsky) 0d94e60 refactor: Use DatabaseStatus and DatabaseOptions types (Russell Yanofsky) b5b4141 wallet: Add MakeDatabase function (Russell Yanofsky) 288b4ff Remove WalletLocation class (Russell Yanofsky) Pull request description: Get rid of file path handling in wallet application code and move it down to database layer. There is no change in behavior except for some changed error messages. Motivation for this change is to make code more understandable, but also to prepare for adding SQLite support in bitcoin#19077 so SQLite implementation can be contained at the database layer and wallet loading code does not need to become more complicated. ACKs for top commit: achow101: ACK 7bf6dfb meshcollider: Code re-review and functional test run ACK 7bf6dfb Tree-SHA512: 23ad18324c9e8947f0cf88a3734c2e9fb25536b2cb4d552cf5d1a4ade320fbffb73bb2d1b3a99585c11630aa7092e0fcfc2dd4fe65b91e3a54161433a5cd13cb
Summary: PR description: > Get rid of file path handling in wallet application code and move it down to database layer. > > There is no change in behavior except for some changed error messages. > > Motivation for this change is to make code more understandable, but also to prepare for adding SQLite support in #19077 so SQLite implementation can be contained at the database layer and wallet loading code does not need to become more complicated. This removes a source of complexity and indirection that makes it harder to understand path checking code. Path checks will be simplified in upcoming commits. There is no change in behavior in this commit other than a slightly more descriptive error message in `loadwallet` if the default "" wallet can't be found. (The error message is improved more in upcoming commit "wallet: Remove path checking code from loadwallet RPC".) This is a backport of [[bitcoin/bitcoin#19619 | core#19619]] [1/8] bitcoin/bitcoin@288b4ff Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D10224
Summary: New function is not currently called but will be called in upcoming commits. It moves database path checking, and existence checking, and already-loaded checking, and verification into a single function so this logic does not need to be repeated all over higher level wallet code, and so higher level code does not need to change when SQLite support is added in bitcoin/bitcoin#19077. This also lets higher level wallet code make fewer assumptions about the contents of wallet directories. This commit just adds the new function and does not change behavior in any way. This is a backport of [[bitcoin/bitcoin#19619 | core#19619]] [2/8] bitcoin/bitcoin@b5b4141 Depends on D10224 Test Plan: `ninja` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10225
Summary: No changes in behavior. Just replaces arguments and return types This is a backport of [[bitcoin/bitcoin#19619 | core#19619]] [3/8] bitcoin/bitcoin@0d94e60 Depends on D10225 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D10226
Summary: Checks are now consolidated in MakeBerkeleyDatabase function instead of happening in higher level code. This commit does not change behavior except for error messages which now include more complete information. This is a backport of [[bitcoin/bitcoin#19619 | core#19619]] [4/8] bitcoin/bitcoin@3c815cf Depends on D10226 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10227
Summary: No changes in behavior This is a backport of [[bitcoin/bitcoin#19619 | core#19619]] [5/8] bitcoin/bitcoin@8b5e729 Depends on D10227 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10228
Summary: This commit does not change behavior except for error messages which now include more complete information. This is a backport of [[bitcoin/bitcoin#19619 | core#19619]] [6/8] bitcoin/bitcoin@a987438 Depends on D10228 Depends on D10213 (for rpc_createmultisig.py) Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10229
Summary: This commit does not change behavior except for error messages which now include more complete information. This is a backport of [[bitcoin/bitcoin#19619 | core#19619]] [7/8] bitcoin/bitcoin@77d5bb7 Depends on D10229 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10230
Summary: This commit does not change behavior except for error messages which now include more complete information. This concludes backport of [[bitcoin/bitcoin#19619 | core#19619]] [8/8] bitcoin/bitcoin@7bf6dfb Depends on D10230 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10231
Get rid of file path handling in wallet application code and move it down to database layer.
There is no change in behavior except for some changed error messages.
Motivation for this change is to make code more understandable, but also to prepare for adding SQLite support in #19077 so SQLite implementation can be contained at the database layer and wallet loading code does not need to become more complicated.