-
Notifications
You must be signed in to change notification settings - Fork 37.7k
[Wallet] move "load wallet phase" to CWallet #7577
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
Looks good to me... utACK. |
Does this need a bump to get travis to check it @jonasschnelli ? |
6c7e51a
to
75c1a80
Compare
Force pushed (no changes), this should give Travis a kick. |
Concept ACK, this is a nice step toward factoring out the wallet code (as well as a step towards being able to load multiple wallets). I do think the return condition is a bit messy, e.g. using both a NULL return value as well as a non-empty errorString as an error condition: + if (!pwalletMain)
+ return false;
...
+ if (!errorString.empty())
+ return InitError(errorString); Ideally, InitLoadWallet would always return NULL if an error happened, and always fill errorString. |
From the initial work I've done on updating some of Jonas's other wallet patches, this is familiar and I agree it can be confusing, especially in some of the more complicated changes where wallet code calls some other wallet code with its own error handling. The intention is to end up with at least one (and preferably only one) error message in the log if something goes wrong. Worst case scenario if we screw up is that the program just shuts down without an error being reported. |
Agree with @laanwj. I wanted to keep the changes at a minimum because this is not the first try to get this into master. Will adapt a better return code handling. |
Sweet, utACK 32ffefc12ba5a5956d64a7c207f0070a11041339. Sorry, no dev machine at present so can't test... |
32ffefc
to
cab3340
Compare
Yes, changing this may be too risky right now, at least this is straightforward and easy to review. utACK |
Needs rebase after #7576 |
cab3340
to
4841d7d
Compare
Rebased. |
if (nLoadWalletRet != DB_LOAD_OK) | ||
{ | ||
if (nLoadWalletRet == DB_CORRUPT) | ||
errorString += _("Error loading wallet.dat: Wallet corrupted") + "\n"; |
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.
Nit: Please don't mix concatenations (+=
)and assignments (=
). You refactored this such that there can only be one error in the errorString
, so an assignment would be sufficient.
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.
My main focus was it to make the change as "moveonly" as possible. The current code also concats error strings (https://github.com/bitcoin/bitcoin/pull/7577/files#diff-c865a8939105e6350a50af02766291b7L1454).
IMO best strategy is to move the wallet code away from init.cpp, then optimize it. This changes was already included in two closed PR (which where closed due to inactivity and lack of review).
We probably should distinct between refactor/"moveonly-ish" PRs and behavior change PRs.
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.
It is ugly but was already the case in the previous version. This literally moves the code. Let's leave improvements here to later pulls.
Concept ACK 4841d7d |
4841d7d
to
dc93117
Compare
dc93117
to
15e6e13
Compare
Bitcoin wallet PRs 2 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#7576 - bitcoin/bitcoin#7577 - bitcoin/bitcoin#7608 - bitcoin/bitcoin#7691 - bitcoin/bitcoin#7905
7e71759 Wallet: Split main logic from InitLoadWallet into CreateWalletFromFile (random-zebra) e585dad [Wallet] refactor wallet/init interaction (random-zebra) 49646b2 [Refactor] Nuke zwalletMain global object (random-zebra) f5f9df9 Wallet: Let the interval-flushing thread figure out the filename (Luke Dashjr) 74445e4 [wallet] Move hardcoded file name out of log messages (random-zebra) 3f1838d [Wallet] optimize return value of InitLoadWallet() (random-zebra) 539dea4 [Wallet] move "load wallet phase" to CWallet (random-zebra) 7644318 [Wallet] move wallet help string creation to CWallet (random-zebra) a9d69b8 [trivial] Reuse translation and cleanup DEFAULT_* values (random-zebra) cfd007a [Bug] Omit wallet-related options from -help when wallet not supported (random-zebra) da642e6 [Refactor] More constant default values cleanup (random-zebra) a45275a [Refactor] Implement CBaseChainParams::BaseParams(Network) (random-zebra) 09abb98 Constrain constant values to a single location in code (random-zebra) Pull request description: Adapts the following refactoring PRs: - bitcoin#6961 Constrain constant values to a single location in code - bitcoin#7576 [Wallet] move wallet help string creation to CWallet - bitcoin#7577 move "load wallet phase" to CWallet - bitcoin#7608 Move hardcoded file name out of log messages - bitcoin#7691 refactor wallet/init interaction - bitcoin#8776 Wallet refactoring leading up to multiwallet ACKs for top commit: furszy: re ACK 7e71759 Fuzzbawls: ACK 7e71759 Tree-SHA512: 5fad328b9ddf8187af97d3d5fb285d0b67e73d51ac1bc44a3d57d0af86bce8b34efaab539b7bdbc4f9a2fa575a936f83788cffcc9c6d6d04cd3e63b19d399400
Another simple and easy-to-review wallet/init.cpp refactoring