CWallet::Create() into CreateNew and LoadExisting
db2effaca4scripted-diff: refactor: CWallet::Create() -> CreateNew() (David Gumberg)27e021ebc0wallet: Correctly log stats for encrypted messages. (David Gumberg)d8bec61be2wallet: remove loading logic from CWallet::Create (David Gumberg)f35acc893frefactor: wallet: Factor out `WriteVersion()` from `PopulateWalletFromDB()` (David Gumberg)e12ff8aca0test: wallet: Split create and load (David Gumberg)70dbc79b09wallet: Use CWallet::LoadExisting() for loading existing wallets. (David Gumberg)ae66e01164wallet: Create separate function for wallet load (David Gumberg)bc69070416refactor: Wallet stats logging in its own function (David Gumberg)a9d64cd49cwallet: Remove redundant birth time update (David Gumberg)b4a49cc727wallet: Move argument parsing to before DB load (David Gumberg)b15a94a618refactor: Split out wallet argument loading (David Gumberg)a02c4a82d8refactor: Move -walletbroadcast setting init (David Gumberg)411caf7281wallet: refactor: PopulateWalletFromDB use switch statement. (David Gumberg)a48e23f566refactor: wallet: move error handling to PopulateWalletFromDB() (David Gumberg)0972785fd7wallet: Delete unnecessary PopulateWalletFromDB() calls (David Gumberg)f0a046094escripted-diff: refactor: CWallet::LoadWallet->PopulateWalletFromDB (David Gumberg) Pull request description: This PR is mostly a refactor which splits out logic used for creating wallets and for loading wallets, both of which are presently contained in `CWallet::Create()` into `CWallet::CreateNew()` and `CWallet::LoadExisting()` The real win of this PR is that `CWallet::Create()` uses a very bad heuristic for trying to guess whether or not it is supposed to be creating a new wallet or loading an existing wallet:370c592612/src/wallet/wallet.cpp (L2882-L2885)This heuristic assumes that wallets with no `ScriptPubKeyMans` are being created, which sounds reasonable, but as demonstrated in #32112 and #32111, this can happen when the user tries to load a wallet file that is corrupted, both issues are fixed by this PR and any other misbehavior for wallet files which succeeded the broken heuristic's sniff test for new wallets. It was already the case that every caller of `CWallet::Create()` knows whether it is creating a wallet or loading one, so we can avoid replacing this bad heuristic with another one, and just shift the burden to the caller. ACKs for top commit: achow101: ACKdb2effaca4polespinasa: approach ACKdb2effaca4w0xlt: reACKdb2effaca4murchandamus: ACKdb2effaca4rkrux: ACKdb2effaca4Tree-SHA512: c28d60e0a3001058da3fd2bdbe0726c7ebe742a4b900a1dee2e5132eccc22e49619cb747a99b4032b000eafd4aa2fdd4ec244c32be2012aba809fdc94b5f6ecd
Bitcoin Core integration/staging tree
For an immediately usable, binary version of the Bitcoin Core software, see https://bitcoincore.org/en/download/.
What is Bitcoin Core?
Bitcoin Core connects to the Bitcoin peer-to-peer network to download and fully validate blocks and transactions. It also includes a wallet and graphical user interface, which can be optionally built.
Further information about Bitcoin Core is available in the doc folder.
License
Bitcoin Core is released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/license/MIT.
Development Process
The master branch is regularly built (see doc/build-*.md for instructions) and tested, but it is not guaranteed to be
completely stable. Tags are created
regularly from release branches to indicate new official, stable release versions of Bitcoin Core.
The https://github.com/bitcoin-core/gui repository is used exclusively for the development of the GUI. Its master branch is identical in all monotree repositories. Release branches and tags do not exist, so please do not fork that repository unless it is for development reasons.
The contribution workflow is described in CONTRIBUTING.md and useful hints for developers can be found in doc/developer-notes.md.
Testing
Testing and code review is the bottleneck for development; we get more pull requests than we can review and test on short notice. Please be patient and help out by testing other people's pull requests, and remember this is a security-critical project where any mistake might cost people lots of money.
Automated Testing
Developers are strongly encouraged to write unit tests for new code, and to
submit new unit tests for old code. Unit tests can be compiled and run
(assuming they weren't disabled during the generation of the build system) with: ctest. Further details on running
and extending unit tests can be found in /src/test/README.md.
There are also regression and integration tests, written
in Python.
These tests can be run (if the test dependencies are installed) with: build/test/functional/test_runner.py
(assuming build is your build directory).
The CI (Continuous Integration) systems make sure that every pull request is tested on Windows, Linux, and macOS. The CI must pass on all commits before merge to avoid unrelated CI failures on new pull requests.
Manual Quality Assurance (QA) Testing
Changes should be tested by somebody other than the developer who wrote the code. This is especially important for large or high-risk changes. It is useful to add a test plan to the pull request description if testing the changes is not straightforward.
Translations
Changes to translations as well as new translations can be submitted to Bitcoin Core's Transifex page.
Translations are periodically pulled from Transifex and merged into the git repository. See the translation process for details on how this works.
Important: We do not accept translation changes as GitHub pull requests because the next pull from Transifex would automatically overwrite them again.