Skip to content

Conversation

luke-jr
Copy link
Member

@luke-jr luke-jr commented Sep 21, 2016

Part of the refactorings needed for basic multiwallet (#8694)

@maflcko maflcko added the Wallet label Sep 21, 2016
Copy link
Contributor

@jonasschnelli jonasschnelli left a 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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: const CWallet *pwallet =

@jonasschnelli
Copy link
Contributor

Needs rebase.

@luke-jr
Copy link
Member Author

luke-jr commented Sep 22, 2016

Rebased

@luke-jr luke-jr force-pushed the multiwallet_prefactor_wallet branch from 682936c to 24539dc Compare September 22, 2016 08:25
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016
@maflcko
Copy link
Member

maflcko commented Oct 22, 2016

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);
Copy link
Member

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

@maflcko maflcko added this to the 0.14.0 milestone Nov 7, 2016
@maflcko
Copy link
Member

maflcko commented Nov 7, 2016

@luke-jr Mind to solve the merge conflict?

Also, assigned 0.14 milestone, I think this is relatively trivial/uncontroversial refactoring.

@luke-jr luke-jr force-pushed the multiwallet_prefactor_wallet branch from 24539dc to 5394b39 Compare November 11, 2016 11:36
@luke-jr
Copy link
Member Author

luke-jr commented Nov 11, 2016

Done

@maflcko
Copy link
Member

maflcko commented Nov 11, 2016

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;
Copy link
Contributor

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.

Copy link
Member Author

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 */
Copy link
Contributor

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);
Copy link
Contributor

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?

Copy link
Member Author

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...

@maflcko
Copy link
Member

maflcko commented Nov 17, 2016

@jonasschnelli Are your comments addressed by the feedback?

@jonasschnelli
Copy link
Contributor

@jonasschnelli Are your comments addressed by the feedback?

Yes.
re-utACK 5394b39

@NicolasDorier
Copy link
Contributor

Code Review ACK.

@gmaxwell
Copy link
Contributor

gmaxwell commented Jan 3, 2017

utACK

@sipa
Copy link
Member

sipa commented Jan 3, 2017

utACK 5394b39

@sipa sipa merged commit 5394b39 into bitcoin:master Jan 3, 2017
sipa added a commit that referenced this pull request Jan 3, 2017
5394b39 Wallet: Split main logic from InitLoadWallet into CreateWalletFromFile (Luke Dashjr)
fb0c934 Wallet: Let the interval-flushing thread figure out the filename (Luke Dashjr)
codablock pushed a commit to codablock/dash that referenced this pull request Jan 18, 2018
5394b39 Wallet: Split main logic from InitLoadWallet into CreateWalletFromFile (Luke Dashjr)
fb0c934 Wallet: Let the interval-flushing thread figure out the filename (Luke Dashjr)
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
5394b39 Wallet: Split main logic from InitLoadWallet into CreateWalletFromFile (Luke Dashjr)
fb0c934 Wallet: Let the interval-flushing thread figure out the filename (Luke Dashjr)
CryptoCentric pushed a commit to absolute-community/absolute that referenced this pull request Feb 26, 2019
5394b39 Wallet: Split main logic from InitLoadWallet into CreateWalletFromFile (Luke Dashjr)
fb0c934 Wallet: Let the interval-flushing thread figure out the filename (Luke Dashjr)
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Aug 25, 2020
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants