c4a29d0a90Update wallet_multiwallet.py for descriptor and sqlite wallets (Russell Yanofsky)310b0fde04Run dumpwallet for legacy wallets only in wallet_backup.py (Andrew Chow)6c6639ac9fInclude sqlite3 in documentation (Andrew Chow)f023b7cac0wallet: Enforce sqlite serialized threading mode (Andrew Chow)6173269866Set and check the sqlite user version (Andrew Chow)9d3d2d263cUse network magic as sqlite wallet application ID (Andrew Chow)9af5de3798Use SQLite for descriptor wallets (Andrew Chow)9b78f3ce8ewalletutil: Wallets can also be sqlite (Andrew Chow)ac38a87225Determine wallet file type based on file magic (Andrew Chow)6045f77003Implement SQLiteDatabase::MakeBatch (Andrew Chow)727e6b2a4eImplement SQLiteDatabase::Verify (Andrew Chow)b4df8fdb19Implement SQLiteDatabase::Rewrite (Andrew Chow)010e365906Implement SQLiteDatabase::TxnBegin, TxnCommit, and TxnAbort (Andrew Chow)ac5c1617e7Implement SQLiteDatabase::Backup (Andrew Chow)f6f9cd6a64Implement SQLiteBatch::StartCursor, ReadAtCursor, and CloseCursor (Andrew Chow)bf90e033f4Implement SQLiteBatch::ReadKey, WriteKey, EraseKey, and HasKey (Andrew Chow)7aa45620e2Add SetupSQLStatements (Andrew Chow)6636a2608aImplement SQLiteBatch::Close (Andrew Chow)93825352a3Implement SQLiteDatabase::Close (Andrew Chow)a0de83372bImplement SQLiteDatabase::Open (Andrew Chow)3bfa0fe125Initialize and Shutdown sqlite3 globals (Andrew Chow)5a488b3d77Constructors, destructors, and relevant private fields for SQLiteDatabase/Batch (Andrew Chow)ca8b7e04abImplement SQLiteDatabaseVersion (Andrew Chow)7577b6e1c8Add SQLiteDatabase and SQLiteBatch dummy classes (Andrew Chow)e87df82580Add sqlite to travis and depends (Andrew Chow)54729f3f4eAdd libsqlite3 (Andrew Chow) Pull request description: This PR adds a new class `SQLiteDatabase` which is a subclass of `WalletDatabase`. This provides access to a SQLite database that is used to store the wallet records. To keep compatibility with BDB and to complexity of the change down, we don't make use of many SQLite's features. We use it strictly as a key-value store. We create a table `main` which has two columns, `key` and `value` both with the type `blob`. For new descriptor wallets, we will create a `SQLiteDatabase` instead of a `BerkeleyDatabase`. There is no requirement that all SQLite wallets are descriptor wallets, nor is there a requirement that all descriptor wallets be SQLite wallets. This allows for existing descriptor wallets to work as well as keeping open the option to migrate existing wallets to SQLite. We keep the name `wallet.dat` for SQLite wallets. We are able to determine which database type to use by searching for specific magic bytes in the `wallet.dat` file. SQLite begins it's files with a null terminated string `SQLite format 3`. BDB has `0x00053162` at byte 12 (note that the byte order of this integer depends on the system endianness). So when we see that there is a `wallet.dat` file that we want to open, we check for the magic bytes to determine which database system to use. I decided to keep the `wallet.dat` naming to keep things like backup script to continue to function as they won't need to be modified to look for a different file name. It also simplifies a couple of things in the implementation and the tests as `wallet.dat` is something that is specifically being looked for. If we don't want this behavior, then I do have another branch which creates `wallet.sqlite` files instead, but I find that this direction is easier. ACKs for top commit: Sjors: re-utACKc4a29d0a90promag: Tested ACKc4a29d0a90. fjahr: reACKc4a29d0a90S3RK: Re-review ACKc4a29d0a90meshcollider: re-utACKc4a29d0a90hebasto: re-ACKc4a29d0a90, only rebased since my [previous](https://github.com/bitcoin/bitcoin/pull/19077#pullrequestreview-507743699) review, verified with `git range-diff master d18892dcc c4a29d0a9`. ryanofsky: Code review ACKc4a29d0a90. I am honestly confused about reasons for locking into `wallet.dat` again when it's so easy now to use a clean format. I assume I'm just very dense, or there's some unstated reason, because the only thing that's been brought up are unrealistic compatibility scenarios (all require actively creating a wallet with non-default descriptor+sqlite option, then trying to using the descriptor+sqlite wallets with old software or scripts and ignoring the results) that we didn't pay attention to with previous PRs like #11687, which did not require any active interfaction. jonatack: ACKc4a29d0a90, debug builds and test runs after rebase to latest master @c2c4dbaebd, some manual testing creating, using, unloading and reloading a few different new sqlite descriptor wallets over several node restarts/shutdowns. Tree-SHA512: 19145732e5001484947352d3175a660b5102bc6e833f227a55bd41b9b2f4d92737bbed7cead64b75b509decf9e1408cd81c185ab1fb4b90561aee427c4f9751c
Bitcoin Core integration/staging tree
What is Bitcoin?
Bitcoin is an experimental digital currency that enables instant payments to anyone, anywhere in the world. Bitcoin uses peer-to-peer technology to operate with no central authority: managing transactions and issuing money are carried out collectively by the network. Bitcoin Core is the name of open source software which enables the use of this currency.
For more information, as well as an immediately usable, binary version of the Bitcoin Core software, see https://bitcoincore.org/en/download/, or read the original whitepaper.
License
Bitcoin Core is released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/licenses/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 in configure) with: make check. 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, that are run automatically on the build server.
These tests can be run (if the test dependencies are installed) with: test/functional/test_runner.py
The Travis CI system makes sure that every pull request is built for Windows, Linux, and macOS, and that unit/sanity tests are run automatically.
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.
Translators should also subscribe to the mailing list.