Wallet refactoring leading up to multiwallet#8776
Conversation
jonasschnelli
left a comment
There was a problem hiding this comment.
Code Review ACK 682936c
src/wallet/wallet.cpp
Outdated
There was a problem hiding this comment.
nit: const CWallet *pwallet =
|
Needs rebase. |
|
Rebased |
682936c to
24539dc
Compare
Github-Pull: bitcoin#8776 Rebased-From: 4a8788f
Github-Pull: bitcoin#8776 Rebased-From: 24539dc
|
utACK 24539dc |
src/init.cpp
Outdated
| if (pwalletMain) { | ||
| // Run a thread to flush wallet periodically | ||
| threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(pwalletMain->strWalletFile))); | ||
| threadGroup.create_thread(ThreadFlushWalletDB); |
There was a problem hiding this comment.
Needs merge conflict solved here
|
@luke-jr Mind to solve the merge conflict? Also, assigned 0.14 milestone, I think this is relatively trivial/uncontroversial refactoring. |
24539dc to
5394b39
Compare
|
Done |
|
utACK 5394b39 |
| if (nRefCount == 0) | ||
| { | ||
| boost::this_thread::interruption_point(); | ||
| const std::string& strFile = pwalletMain->strWalletFile; |
There was a problem hiding this comment.
In theory, this should only be done when holding cs_wallet. I guess changing CWallet::strWalletFile to a const std::string is not possible with the current concept of setting the filename in a instance method.
But maybe I'm wrong.
There was a problem hiding this comment.
wallet.h says "This lock protects all the fields added by CWallet except for: ... strWalletFile (immutable after instantiation)"
| @@ -914,6 +917,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface | |||
| static std::string GetWalletHelpString(bool showDebug); | |||
|
|
|||
| /* Initializes the wallet, returns a new CWallet instance or a null pointer in case of an error */ | |||
There was a problem hiding this comment.
Heh. This (unchanged) comment was wrong before and correct after this PR. :)
| static std::string GetWalletHelpString(bool showDebug); | ||
|
|
||
| /* Initializes the wallet, returns a new CWallet instance or a null pointer in case of an error */ | ||
| static CWallet* CreateWalletFromFile(const std::string walletFile); |
There was a problem hiding this comment.
Maybe declare CreateWalletFromFile() private to avoid layer confusion?
There was a problem hiding this comment.
It's not really intended to be private...
|
@jonasschnelli Are your comments addressed by the feedback? |
|
@jonasschnelli Are your comments addressed by the feedback? Yes. |
|
Code Review ACK. |
|
utACK |
|
utACK 5394b39 |
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
Part of the refactorings needed for basic multiwallet (#8694)