-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Wallet refactoring leading up to multiwallet #8776
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
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 682936c
{ | ||
std::string walletFile = GetArg("-wallet", DEFAULT_WALLET_DAT); | ||
|
||
CWallet * const pwallet = CreateWalletFromFile(walletFile); |
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: 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 |
@@ -1527,7 +1527,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) | |||
#ifdef ENABLE_WALLET | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
@@ -810,6 +810,7 @@ void ThreadFlushWalletDB(const string& strFile) | |||
if (nRefCount == 0) | |||
{ | |||
boost::this_thread::interruption_point(); | |||
const std::string& strFile = pwalletMain->strWalletFile; |
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh. This (unchanged) comment was wrong before and correct after this PR. :)
@@ -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 */ | |||
static CWallet* CreateWalletFromFile(const std::string walletFile); |
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.
Maybe declare CreateWalletFromFile()
private to avoid layer confusion?
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'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)