From 36b6f36ac4724cb2c9ed0e25314c3bbf55e4ebb8 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Wed, 12 Mar 2025 15:42:38 +0100 Subject: [PATCH] build: require sqlite when building the wallet Require that sqlite is available in order to compile the wallet. Removes instances of USE_SQLITE since it is no longer possible to not have sqlite available. The NO_SQLITE option is dropped from depends. Co-authored-by: Ava Chow Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- CMakeLists.txt | 5 +--- CMakePresets.json | 1 - cmake/bitcoin-build-config.h.in | 3 --- depends/Makefile | 5 +--- depends/README.md | 3 +-- depends/toolchain.cmake.in | 7 ------ doc/build-freebsd.md | 2 +- doc/build-openbsd.md | 4 ++-- doc/build-unix.md | 2 +- src/bench/wallet_create.cpp | 3 --- src/bench/wallet_ismine.cpp | 2 -- src/bench/wallet_loading.cpp | 2 -- src/bench/wallet_migration.cpp | 6 ----- src/qt/bitcoingui.cpp | 5 ---- src/wallet/CMakeLists.txt | 14 +++-------- src/wallet/init.cpp | 4 ---- src/wallet/rpc/wallet.cpp | 3 --- src/wallet/test/db_tests.cpp | 7 ------ src/wallet/test/fuzz/CMakeLists.txt | 4 ++-- src/wallet/test/util.h | 2 -- src/wallet/walletdb.cpp | 15 +----------- test/CMakeLists.txt | 1 - test/config.ini.in | 1 - test/functional/feature_filelock.py | 3 +-- test/functional/mempool_persist.py | 6 ++--- .../test_framework/test_framework.py | 23 ++++--------------- test/functional/tool_wallet.py | 3 +-- .../wallet_avoid_mixing_output_types.py | 1 - test/functional/wallet_descriptor.py | 1 - test/functional/wallet_fast_rescan.py | 1 - test/functional/wallet_importdescriptors.py | 1 - test/functional/wallet_listdescriptors.py | 1 - test/functional/wallet_miniscript.py | 1 - ...cript_decaying_multisig_descriptor_psbt.py | 1 - .../wallet_multisig_descriptor_psbt.py | 1 - test/functional/wallet_rescan_unconfirmed.py | 1 - test/functional/wallet_taproot.py | 1 - test/functional/wallet_upgradewallet.py | 17 +++++++------- vcpkg.json | 10 ++------ 40 files changed, 33 insertions(+), 142 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3b55c400f2..4f0ed47b951 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -171,7 +171,7 @@ jobs: generate-options: '-DBUILD_GUI=ON -DWITH_BDB=ON -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DWERROR=ON' job-name: 'Win64 native, VS 2022' - job-type: fuzz - generate-options: '-DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_MANIFEST_FEATURES="sqlite" -DBUILD_GUI=OFF -DBUILD_FOR_FUZZING=ON -DWERROR=ON' + generate-options: '-DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_MANIFEST_FEATURES="wallet" -DBUILD_GUI=OFF -DBUILD_FOR_FUZZING=ON -DWERROR=ON' job-name: 'Win64 native fuzz, VS 2022' steps: diff --git a/CMakeLists.txt b/CMakeLists.txt index f9467a5612d..9488776859d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,15 +102,13 @@ option(BUILD_UTIL_CHAINSTATE "Build experimental bitcoin-chainstate executable." option(BUILD_KERNEL_LIB "Build experimental bitcoinkernel library." ${BUILD_UTIL_CHAINSTATE}) option(ENABLE_WALLET "Enable wallet." ON) -option(WITH_SQLITE "Enable SQLite wallet support." ${ENABLE_WALLET}) -if(WITH_SQLITE) +if(ENABLE_WALLET) if(VCPKG_TARGET_TRIPLET) # Use of the `unofficial::` namespace is a vcpkg package manager convention. find_package(unofficial-sqlite3 CONFIG REQUIRED) else() find_package(SQLite3 3.7.17 REQUIRED) endif() - set(USE_SQLITE ON) endif() option(WITH_BDB "Enable Berkeley DB (BDB) wallet support." OFF) cmake_dependent_option(WARN_INCOMPATIBLE_BDB "Warn when using a Berkeley DB (BDB) version other than 4.8." ON "WITH_BDB" OFF) @@ -652,7 +650,6 @@ message(" libbitcoinkernel (experimental) ..... ${BUILD_KERNEL_LIB}") message("Optional features:") message(" wallet support ...................... ${ENABLE_WALLET}") if(ENABLE_WALLET) - message(" - descriptor wallets (SQLite) ...... ${WITH_SQLITE}") message(" - legacy wallets (Berkeley DB) ..... ${WITH_BDB}") endif() message(" external signer ..................... ${ENABLE_EXTERNAL_SIGNER}") diff --git a/CMakePresets.json b/CMakePresets.json index da838f2b0e3..31cba7e32f4 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -83,7 +83,6 @@ "WITH_BDB": "ON", "WITH_MULTIPROCESS": "ON", "WITH_QRENCODE": "ON", - "WITH_SQLITE": "ON", "WITH_USDT": "ON", "WITH_ZMQ": "ON" } diff --git a/cmake/bitcoin-build-config.h.in b/cmake/bitcoin-build-config.h.in index 56e0519fac1..19d815db0ee 100644 --- a/cmake/bitcoin-build-config.h.in +++ b/cmake/bitcoin-build-config.h.in @@ -144,7 +144,4 @@ /* Define if QR support should be compiled in */ #cmakedefine USE_QRCODE 1 -/* Define if sqlite support should be compiled in */ -#cmakedefine USE_SQLITE 1 - #endif //BITCOIN_CONFIG_H diff --git a/depends/Makefile b/depends/Makefile index 25c86467394..6f42ecb2c63 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -37,7 +37,6 @@ NO_LIBEVENT ?= NO_QT ?= NO_QR ?= NO_BDB ?= -NO_SQLITE ?= NO_WALLET ?= NO_ZMQ ?= NO_USDT ?= @@ -161,8 +160,7 @@ qrencode_packages_$(NO_QR) = $(qrencode_$(host_os)_packages) qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) $(qt_$(host_arch)_$(host_os)_packages) $(qrencode_packages_) bdb_packages_$(NO_BDB) = $(bdb_packages) -sqlite_packages_$(NO_SQLITE) = $(sqlite_packages) -wallet_packages_$(NO_WALLET) = $(bdb_packages_) $(sqlite_packages_) +wallet_packages_$(NO_WALLET) = $(bdb_packages_) $(sqlite_packages) zmq_packages_$(NO_ZMQ) = $(zmq_packages) multiprocess_packages_$(MULTIPROCESS) = $(multiprocess_packages) @@ -234,7 +232,6 @@ $(host_prefix)/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(fina -e 's|@zmq_packages@|$(zmq_packages_)|' \ -e 's|@wallet_packages@|$(wallet_packages_)|' \ -e 's|@bdb_packages@|$(bdb_packages_)|' \ - -e 's|@sqlite_packages@|$(sqlite_packages_)|' \ -e 's|@usdt_packages@|$(usdt_packages_)|' \ -e 's|@no_harden@|$(NO_HARDEN)|' \ -e 's|@multiprocess@|$(MULTIPROCESS)|' \ diff --git a/depends/README.md b/depends/README.md index 848137f03fa..31a0ac111b2 100644 --- a/depends/README.md +++ b/depends/README.md @@ -115,9 +115,8 @@ The following can be set when running make: `make FOO=bar` - `NO_QT`: Don't download/build/cache Qt and its dependencies - `NO_QR`: Don't download/build/cache packages needed for enabling qrencode - `NO_ZMQ`: Don't download/build/cache packages needed for enabling ZeroMQ -- `NO_WALLET`: Don't download/build/cache libs needed to enable the wallet +- `NO_WALLET`: Don't download/build/cache libs needed to enable the wallet (SQLite) - `NO_BDB`: Don't download/build/cache BerkeleyDB -- `NO_SQLITE`: Don't download/build/cache SQLite - `NO_USDT`: Don't download/build/cache packages needed for enabling USDT tracepoints - `MULTIPROCESS`: Build libmultiprocess (experimental) - `DEBUG`: Disable some optimizations and enable more runtime checking diff --git a/depends/toolchain.cmake.in b/depends/toolchain.cmake.in index 89a6e369690..9c3a84c335b 100644 --- a/depends/toolchain.cmake.in +++ b/depends/toolchain.cmake.in @@ -132,13 +132,6 @@ else() set(WITH_BDB ON CACHE BOOL "") endif() -set(sqlite_packages @sqlite_packages@) -if("${wallet_packages}" STREQUAL "" OR "${sqlite_packages}" STREQUAL "") - set(WITH_SQLITE OFF CACHE BOOL "") -else() - set(WITH_SQLITE ON CACHE BOOL "") -endif() - set(usdt_packages @usdt_packages@) if("${usdt_packages}" STREQUAL "") set(WITH_USDT OFF CACHE BOOL "") diff --git a/doc/build-freebsd.md b/doc/build-freebsd.md index 694224621eb..1c78b5c127a 100644 --- a/doc/build-freebsd.md +++ b/doc/build-freebsd.md @@ -42,7 +42,7 @@ from ports. However, you can build DB 4.8 yourself [using depends](/depends). ```bash pkg install gmake -gmake -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_ZMQ=1 NO_USDT=1 +gmake -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_ZMQ=1 NO_USDT=1 ``` When the build is complete, the Berkeley DB installation location will be displayed: diff --git a/doc/build-openbsd.md b/doc/build-openbsd.md index 1ad90f23bcc..e55f2aec9e8 100644 --- a/doc/build-openbsd.md +++ b/doc/build-openbsd.md @@ -44,7 +44,7 @@ from ports. However you can build it yourself, [using depends](/depends). Refer to [depends/README.md](/depends/README.md) for detailed instructions. ```bash -gmake -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_ZMQ=1 NO_USDT=1 +gmake -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_ZMQ=1 NO_USDT=1 ... to: /path/to/bitcoin/depends/*-unknown-openbsd* ``` @@ -103,7 +103,7 @@ There are many ways to configure Bitcoin Core, here are a few common examples: This enables descriptor wallet support and the GUI, assuming SQLite and Qt 5 are installed. ```bash -cmake -B build -DWITH_SQLITE=ON -DBUILD_GUI=ON +cmake -B build -DBUILD_GUI=ON ``` Run `cmake -B build -LH` to see the full list of available options. diff --git a/doc/build-unix.md b/doc/build-unix.md index d891aabc89f..7ebff97bbcb 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -145,7 +145,7 @@ The legacy wallet uses Berkeley DB. To ensure backwards compatibility it is recommended to use Berkeley DB 4.8. If you have to build it yourself, and don't want to use any other libraries built in depends, you can do: ```bash -make -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_ZMQ=1 NO_USDT=1 +make -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_ZMQ=1 NO_USDT=1 ... to: /path/to/bitcoin/depends/x86_64-pc-linux-gnu ``` diff --git a/src/bench/wallet_create.cpp b/src/bench/wallet_create.cpp index 3b916d7c39b..9d3527e7434 100644 --- a/src/bench/wallet_create.cpp +++ b/src/bench/wallet_create.cpp @@ -3,7 +3,6 @@ // file COPYING or https://www.opensource.org/licenses/mit-license.php. #include -#include // IWYU pragma: keep #include #include #include @@ -61,9 +60,7 @@ static void WalletCreate(benchmark::Bench& bench, bool encrypted) static void WalletCreatePlain(benchmark::Bench& bench) { WalletCreate(bench, /*encrypted=*/false); } static void WalletCreateEncrypted(benchmark::Bench& bench) { WalletCreate(bench, /*encrypted=*/true); } -#ifdef USE_SQLITE BENCHMARK(WalletCreatePlain, benchmark::PriorityLevel::LOW); BENCHMARK(WalletCreateEncrypted, benchmark::PriorityLevel::LOW); -#endif } // namespace wallet diff --git a/src/bench/wallet_ismine.cpp b/src/bench/wallet_ismine.cpp index 5343814ab2c..441448c9b19 100644 --- a/src/bench/wallet_ismine.cpp +++ b/src/bench/wallet_ismine.cpp @@ -75,10 +75,8 @@ static void WalletIsMineLegacy(benchmark::Bench& bench) { WalletIsMine(bench, /* BENCHMARK(WalletIsMineLegacy, benchmark::PriorityLevel::LOW); #endif -#ifdef USE_SQLITE static void WalletIsMineDescriptors(benchmark::Bench& bench) { WalletIsMine(bench, /*legacy_wallet=*/false); } static void WalletIsMineMigratedDescriptors(benchmark::Bench& bench) { WalletIsMine(bench, /*legacy_wallet=*/false, /*num_combo=*/2000); } BENCHMARK(WalletIsMineDescriptors, benchmark::PriorityLevel::LOW); BENCHMARK(WalletIsMineMigratedDescriptors, benchmark::PriorityLevel::LOW); -#endif } // namespace wallet diff --git a/src/bench/wallet_loading.cpp b/src/bench/wallet_loading.cpp index 5d92cfa0de4..c15822f29d9 100644 --- a/src/bench/wallet_loading.cpp +++ b/src/bench/wallet_loading.cpp @@ -73,8 +73,6 @@ static void WalletLoadingLegacy(benchmark::Bench& bench) { WalletLoading(bench, BENCHMARK(WalletLoadingLegacy, benchmark::PriorityLevel::HIGH); #endif -#ifdef USE_SQLITE static void WalletLoadingDescriptors(benchmark::Bench& bench) { WalletLoading(bench, /*legacy_wallet=*/false); } BENCHMARK(WalletLoadingDescriptors, benchmark::PriorityLevel::HIGH); -#endif } // namespace wallet diff --git a/src/bench/wallet_migration.cpp b/src/bench/wallet_migration.cpp index 524839e3871..5305833131a 100644 --- a/src/bench/wallet_migration.cpp +++ b/src/bench/wallet_migration.cpp @@ -2,8 +2,6 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or https://www.opensource.org/licenses/mit-license.php. -#include // IWYU pragma: keep - #include #include #include @@ -17,8 +15,6 @@ #include -#if defined(USE_SQLITE) // only enable benchmark when sqlite is enabled - namespace wallet{ static void WalletMigration(benchmark::Bench& bench) @@ -75,5 +71,3 @@ static void WalletMigration(benchmark::Bench& bench) BENCHMARK(WalletMigration, benchmark::PriorityLevel::LOW); } // namespace wallet - -#endif // end USE_SQLITE && USE_BDB diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index f899a524f45..5ca9fba07ca 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1215,11 +1215,6 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer void BitcoinGUI::createWallet() { #ifdef ENABLE_WALLET -#ifndef USE_SQLITE - // Compiled without sqlite support (required for descriptor wallets) - message(tr("Error creating wallet"), tr("Cannot create new wallet, the software was compiled without sqlite support (required for descriptor wallets)"), CClientUIInterface::MSG_ERROR); - return; -#endif // USE_SQLITE auto activity = new CreateWalletActivity(getWalletController(), this); connect(activity, &CreateWalletActivity::created, this, &BitcoinGUI::setCurrentWallet); connect(activity, &CreateWalletActivity::created, rpcConsole, &RPCConsole::setCurrentWallet); diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt index 121e6e3c837..0ea85363a6b 100644 --- a/src/wallet/CMakeLists.txt +++ b/src/wallet/CMakeLists.txt @@ -28,6 +28,7 @@ add_library(bitcoin_wallet STATIC EXCLUDE_FROM_ALL rpc/wallet.cpp scriptpubkeyman.cpp spend.cpp + sqlite.cpp transaction.cpp wallet.cpp walletdb.cpp @@ -37,22 +38,13 @@ target_link_libraries(bitcoin_wallet PRIVATE core_interface bitcoin_common + $ + $ univalue Boost::headers $ ) -if(NOT USE_SQLITE AND NOT USE_BDB) - message(FATAL_ERROR "Wallet functionality requested but no BDB or SQLite support available.") -endif() -if(USE_SQLITE) - target_sources(bitcoin_wallet PRIVATE sqlite.cpp) - target_link_libraries(bitcoin_wallet - PRIVATE - $ - $ - ) -endif() if(USE_BDB) target_sources(bitcoin_wallet PRIVATE bdb.cpp salvage.cpp) target_link_libraries(bitcoin_wallet PUBLIC BerkeleyDB::BerkeleyDB) diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index cfd09a2e101..a0374310552 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -90,11 +90,7 @@ void WalletInit::AddWalletOptions(ArgsManager& argsman) const argsman.AddHiddenArgs({"-dblogsize", "-flushwallet", "-privdb", "-swapbdbendian"}); #endif -#ifdef USE_SQLITE argsman.AddArg("-unsafesqlitesync", "Set SQLite synchronous=OFF to disable waiting for the database to sync to disk. This is unsafe and can cause data loss and corruption. This option is only used by tests to improve their performance (default: false)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST); -#else - argsman.AddHiddenArgs({"-unsafesqlitesync"}); -#endif argsman.AddArg("-walletrejectlongchains", strprintf("Wallet will not create transactions that violate mempool chain limits (default: %u)", DEFAULT_WALLET_REJECT_LONG_CHAINS), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST); argsman.AddArg("-walletcrosschain", strprintf("Allow reusing wallet files across chains (default: %u)", DEFAULT_WALLETCROSSCHAIN), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST); diff --git a/src/wallet/rpc/wallet.cpp b/src/wallet/rpc/wallet.cpp index 89b174d0f7a..1efbbce41cb 100644 --- a/src/wallet/rpc/wallet.cpp +++ b/src/wallet/rpc/wallet.cpp @@ -403,9 +403,6 @@ static RPCHelpMan createwallet() flags |= WALLET_FLAG_AVOID_REUSE; } if (self.Arg("descriptors")) { -#ifndef USE_SQLITE - throw JSONRPCError(RPC_WALLET_ERROR, "Compiled without sqlite support (required for descriptor wallets)"); -#endif flags |= WALLET_FLAG_DESCRIPTORS; } else { if (!context.chain->rpcEnableDeprecated("create_bdb")) { diff --git a/src/wallet/test/db_tests.cpp b/src/wallet/test/db_tests.cpp index 56a39c8d5f3..65f4a8e5f97 100644 --- a/src/wallet/test/db_tests.cpp +++ b/src/wallet/test/db_tests.cpp @@ -13,9 +13,7 @@ #ifdef USE_BDB #include #endif -#ifdef USE_SQLITE #include -#endif #include #include #include // for WALLET_FLAG_DESCRIPTORS @@ -138,9 +136,7 @@ static std::vector> TestDatabases(const fs::path // Needs BDB to make the DB to read dbs.emplace_back(std::make_unique(BDBDataFile(path_root / "bdb"), /*open=*/false)); #endif -#ifdef USE_SQLITE dbs.emplace_back(MakeSQLiteDatabase(path_root / "sqlite", options, status, error)); -#endif dbs.emplace_back(CreateMockableWalletDatabase()); return dbs; } @@ -293,8 +289,6 @@ BOOST_AUTO_TEST_CASE(erase_prefix) } } -#ifdef USE_SQLITE - // Test-only statement execution error constexpr int TEST_SQLITE_ERROR = -999; @@ -385,7 +379,6 @@ BOOST_AUTO_TEST_CASE(concurrent_txn_dont_interfere) BOOST_CHECK(handler2->Read(key, read_value)); BOOST_CHECK_EQUAL(read_value, value2); } -#endif // USE_SQLITE BOOST_AUTO_TEST_SUITE_END() } // namespace wallet diff --git a/src/wallet/test/fuzz/CMakeLists.txt b/src/wallet/test/fuzz/CMakeLists.txt index 7b071e2f127..c290927c09f 100644 --- a/src/wallet/test/fuzz/CMakeLists.txt +++ b/src/wallet/test/fuzz/CMakeLists.txt @@ -8,8 +8,8 @@ target_sources(fuzz coinselection.cpp crypter.cpp fees.cpp - $<$:${CMAKE_CURRENT_LIST_DIR}/notifications.cpp> - $<$:${CMAKE_CURRENT_LIST_DIR}/scriptpubkeyman.cpp> + notifications.cpp + scriptpubkeyman.cpp spend.cpp wallet_bdb_parser.cpp ) diff --git a/src/wallet/test/util.h b/src/wallet/test/util.h index b055c6c6930..801dbacaf19 100644 --- a/src/wallet/test/util.h +++ b/src/wallet/test/util.h @@ -27,9 +27,7 @@ class WalletDatabase; struct WalletContext; static const DatabaseFormat DATABASE_FORMATS[] = { -#ifdef USE_SQLITE DatabaseFormat::SQLITE, -#endif #ifdef USE_BDB DatabaseFormat::BERKELEY, #endif diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index c939ebb1fd4..a19c03d70ef 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -22,9 +22,7 @@ #include #endif #include -#ifdef USE_SQLITE #include -#endif #include #include @@ -1464,25 +1462,14 @@ std::unique_ptr MakeDatabase(const fs::path& path, const Databas // If the format is not specified or detected, choose the default format based on what is available. We prefer BDB over SQLite for now. if (!format) { -#ifdef USE_SQLITE format = DatabaseFormat::SQLITE; -#endif #ifdef USE_BDB format = DatabaseFormat::BERKELEY; #endif } if (format == DatabaseFormat::SQLITE) { -#ifdef USE_SQLITE - if constexpr (true) { - return MakeSQLiteDatabase(path, options, status, error); - } else -#endif - { - error = Untranslated(strprintf("Failed to open database path '%s'. Build does not support SQLite database format.", fs::PathToString(path))); - status = DatabaseStatus::FAILED_BAD_FORMAT; - return nullptr; - } + return MakeSQLiteDatabase(path, options, status, error); } if (format == DatabaseFormat::BERKELEY_RO) { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3a5998697d4..f1d05371ee8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,7 +16,6 @@ function(create_test_config) endmacro() set_configure_variable(ENABLE_WALLET ENABLE_WALLET) - set_configure_variable(WITH_SQLITE USE_SQLITE) set_configure_variable(WITH_BDB USE_BDB) set_configure_variable(BUILD_CLI BUILD_BITCOIN_CLI) set_configure_variable(BUILD_UTIL BUILD_BITCOIN_UTIL) diff --git a/test/config.ini.in b/test/config.ini.in index 3bf79ef25d9..cdd13a9d8c2 100644 --- a/test/config.ini.in +++ b/test/config.ini.in @@ -16,7 +16,6 @@ RPCAUTH=@abs_top_srcdir@/share/rpcauth/rpcauth.py [components] # Which components are enabled. These are commented out by `configure` if they were disabled when running config. @ENABLE_WALLET_TRUE@ENABLE_WALLET=true -@USE_SQLITE_TRUE@USE_SQLITE=true @USE_BDB_TRUE@USE_BDB=true @BUILD_BITCOIN_CLI_TRUE@ENABLE_CLI=true @BUILD_BITCOIN_UTIL_TRUE@ENABLE_BITCOIN_UTIL=true diff --git a/test/functional/feature_filelock.py b/test/functional/feature_filelock.py index aa4ca4b45a7..956c0dbda2c 100755 --- a/test/functional/feature_filelock.py +++ b/test/functional/feature_filelock.py @@ -59,8 +59,7 @@ class FilelockTest(BitcoinTestFramework): if self.is_bdb_compiled(): check_wallet_filelock(False) - if self.is_sqlite_compiled(): - check_wallet_filelock(True) + check_wallet_filelock(True) if __name__ == '__main__': FilelockTest(__file__).main() diff --git a/test/functional/mempool_persist.py b/test/functional/mempool_persist.py index c64c203e504..bf0a97df0df 100755 --- a/test/functional/mempool_persist.py +++ b/test/functional/mempool_persist.py @@ -59,7 +59,7 @@ class MempoolPersistTest(BitcoinTestFramework): def run_test(self): self.mini_wallet = MiniWallet(self.nodes[2]) - if self.is_sqlite_compiled(): + if self.is_wallet_compiled(): self.nodes[2].createwallet( wallet_name="watch", descriptors=True, @@ -73,7 +73,7 @@ class MempoolPersistTest(BitcoinTestFramework): tx_creation_time_lower = int(time.time()) for _ in range(5): last_txid = self.mini_wallet.send_self_transfer(from_node=self.nodes[2])["txid"] - if self.is_sqlite_compiled(): + if self.is_wallet_compiled(): self.nodes[2].syncwithvalidationinterfacequeue() # Flush mempool to wallet node2_balance = wallet_watch.getbalance() self.sync_all() @@ -137,7 +137,7 @@ class MempoolPersistTest(BitcoinTestFramework): assert_equal(entry_prioritised_before_restart['fees']['base'] + Decimal('0.00009999'), entry_prioritised_before_restart['fees']['modified']) # Verify accounting of mempool transactions after restart is correct - if self.is_sqlite_compiled(): + if self.is_wallet_compiled(): self.nodes[2].loadwallet("watch") wallet_watch = self.nodes[2].get_wallet_rpc("watch") self.nodes[2].syncwithvalidationinterfacequeue() # Flush mempool to wallet diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index d5b338f2ba2..7596fca7b9a 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -229,14 +229,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): # So set it to None to force -disablewallet, because the wallet is not needed. self.options.descriptors = None elif self.options.descriptors is None: - # Some wallet is either required or optionally used by the test. - # Prefer SQLite unless it isn't available - if self.is_sqlite_compiled(): + if self.is_wallet_compiled(): self.options.descriptors = True - elif self.is_bdb_compiled(): - self.options.descriptors = False else: - # If neither are compiled, tests requiring a wallet will be skipped and the value of self.options.descriptors won't matter + # Tests requiring a wallet will be skipped and the value of self.options.descriptors won't matter # It still needs to exist and be None in order for tests to work however. # So set it to None, which will also set -disablewallet. self.options.descriptors = None @@ -966,16 +962,9 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): self._requires_wallet = True if not self.is_wallet_compiled(): raise SkipTest("wallet has not been compiled.") - if self.options.descriptors: - self.skip_if_no_sqlite() - else: + if not self.options.descriptors: self.skip_if_no_bdb() - def skip_if_no_sqlite(self): - """Skip the running test if sqlite has not been compiled.""" - if not self.is_sqlite_compiled(): - raise SkipTest("sqlite has not been compiled.") - def skip_if_no_bdb(self): """Skip the running test if BDB has not been compiled.""" if not self.is_bdb_compiled(): @@ -1030,7 +1019,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): """Checks whether wallet support for the specified type (legacy or descriptor wallet) was compiled.""" if self.options.descriptors: - return self.is_sqlite_compiled() + return self.is_wallet_compiled() else: return self.is_bdb_compiled() @@ -1050,10 +1039,6 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): """Checks whether the USDT tracepoints were compiled.""" return self.config["components"].getboolean("ENABLE_USDT_TRACEPOINTS") - def is_sqlite_compiled(self): - """Checks whether the wallet module was compiled with Sqlite support.""" - return self.config["components"].getboolean("USE_SQLITE") - def is_bdb_compiled(self): """Checks whether the wallet module was compiled with BDB support.""" return self.config["components"].getboolean("USE_BDB") diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py index b0b9adab879..53a3bc8d048 100755 --- a/test/functional/tool_wallet.py +++ b/test/functional/tool_wallet.py @@ -367,8 +367,7 @@ class ToolWalletTest(BitcoinTestFramework): self.do_tool_createfromdump("load", "wallet.dump") if self.is_bdb_compiled(): self.do_tool_createfromdump("load-bdb", "wallet.dump", "bdb") - if self.is_sqlite_compiled(): - self.do_tool_createfromdump("load-sqlite", "wallet.dump", "sqlite") + self.do_tool_createfromdump("load-sqlite", "wallet.dump", "sqlite") self.log.info('Checking createfromdump handling of magic and versions') bad_ver_wallet_dump = self.nodes[0].datadir_path / "wallet-bad_ver1.dump" diff --git a/test/functional/wallet_avoid_mixing_output_types.py b/test/functional/wallet_avoid_mixing_output_types.py index 146b3df3f4d..47a4cc9a6cd 100755 --- a/test/functional/wallet_avoid_mixing_output_types.py +++ b/test/functional/wallet_avoid_mixing_output_types.py @@ -127,7 +127,6 @@ class AddressInputTypeGrouping(BitcoinTestFramework): def skip_test_if_missing_module(self): self.skip_if_no_wallet() - self.skip_if_no_sqlite() def make_payment(self, A, B, v, addr_type): fee_rate = random.randint(1, 20) diff --git a/test/functional/wallet_descriptor.py b/test/functional/wallet_descriptor.py index 5e0ee978921..0071d671c2c 100755 --- a/test/functional/wallet_descriptor.py +++ b/test/functional/wallet_descriptor.py @@ -33,7 +33,6 @@ class WalletDescriptorTest(BitcoinTestFramework): def skip_test_if_missing_module(self): self.skip_if_no_wallet() - self.skip_if_no_sqlite() self.skip_if_no_py_sqlite3() def test_concurrent_writes(self): diff --git a/test/functional/wallet_fast_rescan.py b/test/functional/wallet_fast_rescan.py index 6cee0d36608..1a9c319cb1a 100755 --- a/test/functional/wallet_fast_rescan.py +++ b/test/functional/wallet_fast_rescan.py @@ -28,7 +28,6 @@ class WalletFastRescanTest(BitcoinTestFramework): def skip_test_if_missing_module(self): self.skip_if_no_wallet() - self.skip_if_no_sqlite() def get_wallet_txids(self, node: TestNode, wallet_name: str) -> list[str]: w = node.get_wallet_rpc(wallet_name) diff --git a/test/functional/wallet_importdescriptors.py b/test/functional/wallet_importdescriptors.py index 84c07b6a282..f55c1a1eb31 100755 --- a/test/functional/wallet_importdescriptors.py +++ b/test/functional/wallet_importdescriptors.py @@ -47,7 +47,6 @@ class ImportDescriptorsTest(BitcoinTestFramework): def skip_test_if_missing_module(self): self.skip_if_no_wallet() - self.skip_if_no_sqlite() def test_importdesc(self, req, success, error_code=None, error_message=None, warnings=None, wallet=None): """Run importdescriptors and assert success""" diff --git a/test/functional/wallet_listdescriptors.py b/test/functional/wallet_listdescriptors.py index c9d6c1f190d..35be527b32b 100755 --- a/test/functional/wallet_listdescriptors.py +++ b/test/functional/wallet_listdescriptors.py @@ -26,7 +26,6 @@ class ListDescriptorsTest(BitcoinTestFramework): def skip_test_if_missing_module(self): self.skip_if_no_wallet() - self.skip_if_no_sqlite() # do not create any wallet by default def init_wallet(self, *, node): diff --git a/test/functional/wallet_miniscript.py b/test/functional/wallet_miniscript.py index 064eac499b2..748faf14e20 100755 --- a/test/functional/wallet_miniscript.py +++ b/test/functional/wallet_miniscript.py @@ -212,7 +212,6 @@ class WalletMiniscriptTest(BitcoinTestFramework): def skip_test_if_missing_module(self): self.skip_if_no_wallet() - self.skip_if_no_sqlite() def watchonly_test(self, desc): self.log.info(f"Importing descriptor '{desc}'") diff --git a/test/functional/wallet_miniscript_decaying_multisig_descriptor_psbt.py b/test/functional/wallet_miniscript_decaying_multisig_descriptor_psbt.py index 43fc3415f12..1c8c4de492f 100755 --- a/test/functional/wallet_miniscript_decaying_multisig_descriptor_psbt.py +++ b/test/functional/wallet_miniscript_decaying_multisig_descriptor_psbt.py @@ -29,7 +29,6 @@ class WalletMiniscriptDecayingMultisigDescriptorPSBTTest(BitcoinTestFramework): def skip_test_if_missing_module(self): self.skip_if_no_wallet() - self.skip_if_no_sqlite() @staticmethod def _get_xpub(wallet, internal): diff --git a/test/functional/wallet_multisig_descriptor_psbt.py b/test/functional/wallet_multisig_descriptor_psbt.py index a69185b3a5f..23a9a4cc755 100755 --- a/test/functional/wallet_multisig_descriptor_psbt.py +++ b/test/functional/wallet_multisig_descriptor_psbt.py @@ -26,7 +26,6 @@ class WalletMultisigDescriptorPSBTTest(BitcoinTestFramework): def skip_test_if_missing_module(self): self.skip_if_no_wallet() - self.skip_if_no_sqlite() @staticmethod def _get_xpub(wallet, internal): diff --git a/test/functional/wallet_rescan_unconfirmed.py b/test/functional/wallet_rescan_unconfirmed.py index 69ad522b5d3..23c58b92f42 100755 --- a/test/functional/wallet_rescan_unconfirmed.py +++ b/test/functional/wallet_rescan_unconfirmed.py @@ -24,7 +24,6 @@ class WalletRescanUnconfirmed(BitcoinTestFramework): def skip_test_if_missing_module(self): self.skip_if_no_wallet() - self.skip_if_no_sqlite() def run_test(self): self.log.info("Create wallets and mine initial chain") diff --git a/test/functional/wallet_taproot.py b/test/functional/wallet_taproot.py index a88d84f4c6b..cc9683fcded 100755 --- a/test/functional/wallet_taproot.py +++ b/test/functional/wallet_taproot.py @@ -198,7 +198,6 @@ class WalletTaprootTest(BitcoinTestFramework): def skip_test_if_missing_module(self): self.skip_if_no_wallet() - self.skip_if_no_sqlite() def setup_network(self): self.setup_nodes() diff --git a/test/functional/wallet_upgradewallet.py b/test/functional/wallet_upgradewallet.py index c909336a25f..e1bb098ec74 100755 --- a/test/functional/wallet_upgradewallet.py +++ b/test/functional/wallet_upgradewallet.py @@ -343,16 +343,15 @@ class UpgradeWalletTest(BitcoinTestFramework): v16_3_kvs = dump_bdb_kv(v16_3_wallet) assert b'\x0adefaultkey' not in v16_3_kvs - if self.is_sqlite_compiled(): - self.log.info("Checking that descriptor wallets do nothing, successfully") - self.nodes[0].createwallet(wallet_name="desc_upgrade", descriptors=True) - desc_wallet = self.nodes[0].get_wallet_rpc("desc_upgrade") - self.test_upgradewallet(desc_wallet, previous_version=169900, expected_version=169900) + self.log.info("Checking that descriptor wallets do nothing, successfully") + self.nodes[0].createwallet(wallet_name="desc_upgrade", descriptors=True) + desc_wallet = self.nodes[0].get_wallet_rpc("desc_upgrade") + self.test_upgradewallet(desc_wallet, previous_version=169900, expected_version=169900) - self.log.info("Checking that descriptor wallets without privkeys do nothing, successfully") - self.nodes[0].createwallet(wallet_name="desc_upgrade_nopriv", descriptors=True, disable_private_keys=True) - desc_wallet = self.nodes[0].get_wallet_rpc("desc_upgrade_nopriv") - self.test_upgradewallet(desc_wallet, previous_version=169900, expected_version=169900) + self.log.info("Checking that descriptor wallets without privkeys do nothing, successfully") + self.nodes[0].createwallet(wallet_name="desc_upgrade_nopriv", descriptors=True, disable_private_keys=True) + desc_wallet = self.nodes[0].get_wallet_rpc("desc_upgrade_nopriv") + self.test_upgradewallet(desc_wallet, previous_version=169900, expected_version=169900) if self.is_bdb_compiled(): self.log.info("Upgrading a wallet with private keys disabled") diff --git a/vcpkg.json b/vcpkg.json index d5dfb05ebe0..66ffb85e726 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -11,6 +11,7 @@ "qt5", "tests", "wallet", + "berkeleydb", "zeromq" ], "features": { @@ -28,12 +29,6 @@ "libqrencode" ] }, - "sqlite": { - "description": "Enable SQLite wallet support", - "dependencies": [ - "sqlite3" - ] - }, "tests": { "description": "Build test_bitcoin.exe executable", "dependencies": [ @@ -41,9 +36,8 @@ ] }, "wallet": { - "description": "Enable wallet", + "description": "Enable wallet (SQLite)", "dependencies": [ - "berkeleydb", "sqlite3" ] },