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 <github@achow101.com>
Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
This commit is contained in:
Sjors Provoost 2025-03-12 15:42:38 +01:00
parent 502d47203e
commit 36b6f36ac4
No known key found for this signature in database
GPG Key ID: 57FF9BDBCC301009
40 changed files with 33 additions and 142 deletions

View File

@ -171,7 +171,7 @@ jobs:
generate-options: '-DBUILD_GUI=ON -DWITH_BDB=ON -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DWERROR=ON' generate-options: '-DBUILD_GUI=ON -DWITH_BDB=ON -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DWERROR=ON'
job-name: 'Win64 native, VS 2022' job-name: 'Win64 native, VS 2022'
- job-type: fuzz - 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' job-name: 'Win64 native fuzz, VS 2022'
steps: steps:

View File

@ -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(BUILD_KERNEL_LIB "Build experimental bitcoinkernel library." ${BUILD_UTIL_CHAINSTATE})
option(ENABLE_WALLET "Enable wallet." ON) option(ENABLE_WALLET "Enable wallet." ON)
option(WITH_SQLITE "Enable SQLite wallet support." ${ENABLE_WALLET}) if(ENABLE_WALLET)
if(WITH_SQLITE)
if(VCPKG_TARGET_TRIPLET) if(VCPKG_TARGET_TRIPLET)
# Use of the `unofficial::` namespace is a vcpkg package manager convention. # Use of the `unofficial::` namespace is a vcpkg package manager convention.
find_package(unofficial-sqlite3 CONFIG REQUIRED) find_package(unofficial-sqlite3 CONFIG REQUIRED)
else() else()
find_package(SQLite3 3.7.17 REQUIRED) find_package(SQLite3 3.7.17 REQUIRED)
endif() endif()
set(USE_SQLITE ON)
endif() endif()
option(WITH_BDB "Enable Berkeley DB (BDB) wallet support." OFF) 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) 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("Optional features:")
message(" wallet support ...................... ${ENABLE_WALLET}") message(" wallet support ...................... ${ENABLE_WALLET}")
if(ENABLE_WALLET) if(ENABLE_WALLET)
message(" - descriptor wallets (SQLite) ...... ${WITH_SQLITE}")
message(" - legacy wallets (Berkeley DB) ..... ${WITH_BDB}") message(" - legacy wallets (Berkeley DB) ..... ${WITH_BDB}")
endif() endif()
message(" external signer ..................... ${ENABLE_EXTERNAL_SIGNER}") message(" external signer ..................... ${ENABLE_EXTERNAL_SIGNER}")

View File

@ -83,7 +83,6 @@
"WITH_BDB": "ON", "WITH_BDB": "ON",
"WITH_MULTIPROCESS": "ON", "WITH_MULTIPROCESS": "ON",
"WITH_QRENCODE": "ON", "WITH_QRENCODE": "ON",
"WITH_SQLITE": "ON",
"WITH_USDT": "ON", "WITH_USDT": "ON",
"WITH_ZMQ": "ON" "WITH_ZMQ": "ON"
} }

View File

@ -144,7 +144,4 @@
/* Define if QR support should be compiled in */ /* Define if QR support should be compiled in */
#cmakedefine USE_QRCODE 1 #cmakedefine USE_QRCODE 1
/* Define if sqlite support should be compiled in */
#cmakedefine USE_SQLITE 1
#endif //BITCOIN_CONFIG_H #endif //BITCOIN_CONFIG_H

View File

@ -37,7 +37,6 @@ NO_LIBEVENT ?=
NO_QT ?= NO_QT ?=
NO_QR ?= NO_QR ?=
NO_BDB ?= NO_BDB ?=
NO_SQLITE ?=
NO_WALLET ?= NO_WALLET ?=
NO_ZMQ ?= NO_ZMQ ?=
NO_USDT ?= 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_) qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) $(qt_$(host_arch)_$(host_os)_packages) $(qrencode_packages_)
bdb_packages_$(NO_BDB) = $(bdb_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) zmq_packages_$(NO_ZMQ) = $(zmq_packages)
multiprocess_packages_$(MULTIPROCESS) = $(multiprocess_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|@zmq_packages@|$(zmq_packages_)|' \
-e 's|@wallet_packages@|$(wallet_packages_)|' \ -e 's|@wallet_packages@|$(wallet_packages_)|' \
-e 's|@bdb_packages@|$(bdb_packages_)|' \ -e 's|@bdb_packages@|$(bdb_packages_)|' \
-e 's|@sqlite_packages@|$(sqlite_packages_)|' \
-e 's|@usdt_packages@|$(usdt_packages_)|' \ -e 's|@usdt_packages@|$(usdt_packages_)|' \
-e 's|@no_harden@|$(NO_HARDEN)|' \ -e 's|@no_harden@|$(NO_HARDEN)|' \
-e 's|@multiprocess@|$(MULTIPROCESS)|' \ -e 's|@multiprocess@|$(MULTIPROCESS)|' \

View File

@ -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_QT`: Don't download/build/cache Qt and its dependencies
- `NO_QR`: Don't download/build/cache packages needed for enabling qrencode - `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_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_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 - `NO_USDT`: Don't download/build/cache packages needed for enabling USDT tracepoints
- `MULTIPROCESS`: Build libmultiprocess (experimental) - `MULTIPROCESS`: Build libmultiprocess (experimental)
- `DEBUG`: Disable some optimizations and enable more runtime checking - `DEBUG`: Disable some optimizations and enable more runtime checking

View File

@ -132,13 +132,6 @@ else()
set(WITH_BDB ON CACHE BOOL "") set(WITH_BDB ON CACHE BOOL "")
endif() 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@) set(usdt_packages @usdt_packages@)
if("${usdt_packages}" STREQUAL "") if("${usdt_packages}" STREQUAL "")
set(WITH_USDT OFF CACHE BOOL "") set(WITH_USDT OFF CACHE BOOL "")

View File

@ -42,7 +42,7 @@ from ports. However, you can build DB 4.8 yourself [using depends](/depends).
```bash ```bash
pkg install gmake 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: When the build is complete, the Berkeley DB installation location will be displayed:

View File

@ -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. Refer to [depends/README.md](/depends/README.md) for detailed instructions.
```bash ```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* 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. This enables descriptor wallet support and the GUI, assuming SQLite and Qt 5 are installed.
```bash ```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. Run `cmake -B build -LH` to see the full list of available options.

View File

@ -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 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: want to use any other libraries built in depends, you can do:
```bash ```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 to: /path/to/bitcoin/depends/x86_64-pc-linux-gnu
``` ```

View File

@ -3,7 +3,6 @@
// file COPYING or https://www.opensource.org/licenses/mit-license.php. // file COPYING or https://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h> #include <bench/bench.h>
#include <bitcoin-build-config.h> // IWYU pragma: keep
#include <random.h> #include <random.h>
#include <support/allocators/secure.h> #include <support/allocators/secure.h>
#include <test/util/setup_common.h> #include <test/util/setup_common.h>
@ -61,9 +60,7 @@ static void WalletCreate(benchmark::Bench& bench, bool encrypted)
static void WalletCreatePlain(benchmark::Bench& bench) { WalletCreate(bench, /*encrypted=*/false); } static void WalletCreatePlain(benchmark::Bench& bench) { WalletCreate(bench, /*encrypted=*/false); }
static void WalletCreateEncrypted(benchmark::Bench& bench) { WalletCreate(bench, /*encrypted=*/true); } static void WalletCreateEncrypted(benchmark::Bench& bench) { WalletCreate(bench, /*encrypted=*/true); }
#ifdef USE_SQLITE
BENCHMARK(WalletCreatePlain, benchmark::PriorityLevel::LOW); BENCHMARK(WalletCreatePlain, benchmark::PriorityLevel::LOW);
BENCHMARK(WalletCreateEncrypted, benchmark::PriorityLevel::LOW); BENCHMARK(WalletCreateEncrypted, benchmark::PriorityLevel::LOW);
#endif
} // namespace wallet } // namespace wallet

View File

@ -75,10 +75,8 @@ static void WalletIsMineLegacy(benchmark::Bench& bench) { WalletIsMine(bench, /*
BENCHMARK(WalletIsMineLegacy, benchmark::PriorityLevel::LOW); BENCHMARK(WalletIsMineLegacy, benchmark::PriorityLevel::LOW);
#endif #endif
#ifdef USE_SQLITE
static void WalletIsMineDescriptors(benchmark::Bench& bench) { WalletIsMine(bench, /*legacy_wallet=*/false); } 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); } static void WalletIsMineMigratedDescriptors(benchmark::Bench& bench) { WalletIsMine(bench, /*legacy_wallet=*/false, /*num_combo=*/2000); }
BENCHMARK(WalletIsMineDescriptors, benchmark::PriorityLevel::LOW); BENCHMARK(WalletIsMineDescriptors, benchmark::PriorityLevel::LOW);
BENCHMARK(WalletIsMineMigratedDescriptors, benchmark::PriorityLevel::LOW); BENCHMARK(WalletIsMineMigratedDescriptors, benchmark::PriorityLevel::LOW);
#endif
} // namespace wallet } // namespace wallet

View File

@ -73,8 +73,6 @@ static void WalletLoadingLegacy(benchmark::Bench& bench) { WalletLoading(bench,
BENCHMARK(WalletLoadingLegacy, benchmark::PriorityLevel::HIGH); BENCHMARK(WalletLoadingLegacy, benchmark::PriorityLevel::HIGH);
#endif #endif
#ifdef USE_SQLITE
static void WalletLoadingDescriptors(benchmark::Bench& bench) { WalletLoading(bench, /*legacy_wallet=*/false); } static void WalletLoadingDescriptors(benchmark::Bench& bench) { WalletLoading(bench, /*legacy_wallet=*/false); }
BENCHMARK(WalletLoadingDescriptors, benchmark::PriorityLevel::HIGH); BENCHMARK(WalletLoadingDescriptors, benchmark::PriorityLevel::HIGH);
#endif
} // namespace wallet } // namespace wallet

View File

@ -2,8 +2,6 @@
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php. // file COPYING or https://www.opensource.org/licenses/mit-license.php.
#include <bitcoin-build-config.h> // IWYU pragma: keep
#include <bench/bench.h> #include <bench/bench.h>
#include <kernel/chain.h> #include <kernel/chain.h>
#include <interfaces/chain.h> #include <interfaces/chain.h>
@ -17,8 +15,6 @@
#include <optional> #include <optional>
#if defined(USE_SQLITE) // only enable benchmark when sqlite is enabled
namespace wallet{ namespace wallet{
static void WalletMigration(benchmark::Bench& bench) static void WalletMigration(benchmark::Bench& bench)
@ -75,5 +71,3 @@ static void WalletMigration(benchmark::Bench& bench)
BENCHMARK(WalletMigration, benchmark::PriorityLevel::LOW); BENCHMARK(WalletMigration, benchmark::PriorityLevel::LOW);
} // namespace wallet } // namespace wallet
#endif // end USE_SQLITE && USE_BDB

View File

@ -1215,11 +1215,6 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
void BitcoinGUI::createWallet() void BitcoinGUI::createWallet()
{ {
#ifdef ENABLE_WALLET #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); auto activity = new CreateWalletActivity(getWalletController(), this);
connect(activity, &CreateWalletActivity::created, this, &BitcoinGUI::setCurrentWallet); connect(activity, &CreateWalletActivity::created, this, &BitcoinGUI::setCurrentWallet);
connect(activity, &CreateWalletActivity::created, rpcConsole, &RPCConsole::setCurrentWallet); connect(activity, &CreateWalletActivity::created, rpcConsole, &RPCConsole::setCurrentWallet);

View File

@ -28,6 +28,7 @@ add_library(bitcoin_wallet STATIC EXCLUDE_FROM_ALL
rpc/wallet.cpp rpc/wallet.cpp
scriptpubkeyman.cpp scriptpubkeyman.cpp
spend.cpp spend.cpp
sqlite.cpp
transaction.cpp transaction.cpp
wallet.cpp wallet.cpp
walletdb.cpp walletdb.cpp
@ -37,22 +38,13 @@ target_link_libraries(bitcoin_wallet
PRIVATE PRIVATE
core_interface core_interface
bitcoin_common bitcoin_common
$<TARGET_NAME_IF_EXISTS:unofficial::sqlite3::sqlite3>
$<TARGET_NAME_IF_EXISTS:SQLite::SQLite3>
univalue univalue
Boost::headers Boost::headers
$<TARGET_NAME_IF_EXISTS:USDT::headers> $<TARGET_NAME_IF_EXISTS:USDT::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
$<TARGET_NAME_IF_EXISTS:unofficial::sqlite3::sqlite3>
$<TARGET_NAME_IF_EXISTS:SQLite::SQLite3>
)
endif()
if(USE_BDB) if(USE_BDB)
target_sources(bitcoin_wallet PRIVATE bdb.cpp salvage.cpp) target_sources(bitcoin_wallet PRIVATE bdb.cpp salvage.cpp)
target_link_libraries(bitcoin_wallet PUBLIC BerkeleyDB::BerkeleyDB) target_link_libraries(bitcoin_wallet PUBLIC BerkeleyDB::BerkeleyDB)

View File

@ -90,11 +90,7 @@ void WalletInit::AddWalletOptions(ArgsManager& argsman) const
argsman.AddHiddenArgs({"-dblogsize", "-flushwallet", "-privdb", "-swapbdbendian"}); argsman.AddHiddenArgs({"-dblogsize", "-flushwallet", "-privdb", "-swapbdbendian"});
#endif #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); 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("-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); argsman.AddArg("-walletcrosschain", strprintf("Allow reusing wallet files across chains (default: %u)", DEFAULT_WALLETCROSSCHAIN), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST);

View File

@ -403,9 +403,6 @@ static RPCHelpMan createwallet()
flags |= WALLET_FLAG_AVOID_REUSE; flags |= WALLET_FLAG_AVOID_REUSE;
} }
if (self.Arg<bool>("descriptors")) { if (self.Arg<bool>("descriptors")) {
#ifndef USE_SQLITE
throw JSONRPCError(RPC_WALLET_ERROR, "Compiled without sqlite support (required for descriptor wallets)");
#endif
flags |= WALLET_FLAG_DESCRIPTORS; flags |= WALLET_FLAG_DESCRIPTORS;
} else { } else {
if (!context.chain->rpcEnableDeprecated("create_bdb")) { if (!context.chain->rpcEnableDeprecated("create_bdb")) {

View File

@ -13,9 +13,7 @@
#ifdef USE_BDB #ifdef USE_BDB
#include <wallet/bdb.h> #include <wallet/bdb.h>
#endif #endif
#ifdef USE_SQLITE
#include <wallet/sqlite.h> #include <wallet/sqlite.h>
#endif
#include <wallet/migrate.h> #include <wallet/migrate.h>
#include <wallet/test/util.h> #include <wallet/test/util.h>
#include <wallet/walletutil.h> // for WALLET_FLAG_DESCRIPTORS #include <wallet/walletutil.h> // for WALLET_FLAG_DESCRIPTORS
@ -138,9 +136,7 @@ static std::vector<std::unique_ptr<WalletDatabase>> TestDatabases(const fs::path
// Needs BDB to make the DB to read // Needs BDB to make the DB to read
dbs.emplace_back(std::make_unique<BerkeleyRODatabase>(BDBDataFile(path_root / "bdb"), /*open=*/false)); dbs.emplace_back(std::make_unique<BerkeleyRODatabase>(BDBDataFile(path_root / "bdb"), /*open=*/false));
#endif #endif
#ifdef USE_SQLITE
dbs.emplace_back(MakeSQLiteDatabase(path_root / "sqlite", options, status, error)); dbs.emplace_back(MakeSQLiteDatabase(path_root / "sqlite", options, status, error));
#endif
dbs.emplace_back(CreateMockableWalletDatabase()); dbs.emplace_back(CreateMockableWalletDatabase());
return dbs; return dbs;
} }
@ -293,8 +289,6 @@ BOOST_AUTO_TEST_CASE(erase_prefix)
} }
} }
#ifdef USE_SQLITE
// Test-only statement execution error // Test-only statement execution error
constexpr int TEST_SQLITE_ERROR = -999; 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(handler2->Read(key, read_value));
BOOST_CHECK_EQUAL(read_value, value2); BOOST_CHECK_EQUAL(read_value, value2);
} }
#endif // USE_SQLITE
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()
} // namespace wallet } // namespace wallet

View File

@ -8,8 +8,8 @@ target_sources(fuzz
coinselection.cpp coinselection.cpp
crypter.cpp crypter.cpp
fees.cpp fees.cpp
$<$<BOOL:${USE_SQLITE}>:${CMAKE_CURRENT_LIST_DIR}/notifications.cpp> notifications.cpp
$<$<BOOL:${USE_SQLITE}>:${CMAKE_CURRENT_LIST_DIR}/scriptpubkeyman.cpp> scriptpubkeyman.cpp
spend.cpp spend.cpp
wallet_bdb_parser.cpp wallet_bdb_parser.cpp
) )

View File

@ -27,9 +27,7 @@ class WalletDatabase;
struct WalletContext; struct WalletContext;
static const DatabaseFormat DATABASE_FORMATS[] = { static const DatabaseFormat DATABASE_FORMATS[] = {
#ifdef USE_SQLITE
DatabaseFormat::SQLITE, DatabaseFormat::SQLITE,
#endif
#ifdef USE_BDB #ifdef USE_BDB
DatabaseFormat::BERKELEY, DatabaseFormat::BERKELEY,
#endif #endif

View File

@ -22,9 +22,7 @@
#include <wallet/bdb.h> #include <wallet/bdb.h>
#endif #endif
#include <wallet/migrate.h> #include <wallet/migrate.h>
#ifdef USE_SQLITE
#include <wallet/sqlite.h> #include <wallet/sqlite.h>
#endif
#include <wallet/wallet.h> #include <wallet/wallet.h>
#include <atomic> #include <atomic>
@ -1464,25 +1462,14 @@ std::unique_ptr<WalletDatabase> 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 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) { if (!format) {
#ifdef USE_SQLITE
format = DatabaseFormat::SQLITE; format = DatabaseFormat::SQLITE;
#endif
#ifdef USE_BDB #ifdef USE_BDB
format = DatabaseFormat::BERKELEY; format = DatabaseFormat::BERKELEY;
#endif #endif
} }
if (format == DatabaseFormat::SQLITE) { if (format == DatabaseFormat::SQLITE) {
#ifdef USE_SQLITE return MakeSQLiteDatabase(path, options, status, error);
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;
}
} }
if (format == DatabaseFormat::BERKELEY_RO) { if (format == DatabaseFormat::BERKELEY_RO) {

View File

@ -16,7 +16,6 @@ function(create_test_config)
endmacro() endmacro()
set_configure_variable(ENABLE_WALLET ENABLE_WALLET) set_configure_variable(ENABLE_WALLET ENABLE_WALLET)
set_configure_variable(WITH_SQLITE USE_SQLITE)
set_configure_variable(WITH_BDB USE_BDB) set_configure_variable(WITH_BDB USE_BDB)
set_configure_variable(BUILD_CLI BUILD_BITCOIN_CLI) set_configure_variable(BUILD_CLI BUILD_BITCOIN_CLI)
set_configure_variable(BUILD_UTIL BUILD_BITCOIN_UTIL) set_configure_variable(BUILD_UTIL BUILD_BITCOIN_UTIL)

View File

@ -16,7 +16,6 @@ RPCAUTH=@abs_top_srcdir@/share/rpcauth/rpcauth.py
[components] [components]
# Which components are enabled. These are commented out by `configure` if they were disabled when running config. # Which components are enabled. These are commented out by `configure` if they were disabled when running config.
@ENABLE_WALLET_TRUE@ENABLE_WALLET=true @ENABLE_WALLET_TRUE@ENABLE_WALLET=true
@USE_SQLITE_TRUE@USE_SQLITE=true
@USE_BDB_TRUE@USE_BDB=true @USE_BDB_TRUE@USE_BDB=true
@BUILD_BITCOIN_CLI_TRUE@ENABLE_CLI=true @BUILD_BITCOIN_CLI_TRUE@ENABLE_CLI=true
@BUILD_BITCOIN_UTIL_TRUE@ENABLE_BITCOIN_UTIL=true @BUILD_BITCOIN_UTIL_TRUE@ENABLE_BITCOIN_UTIL=true

View File

@ -59,8 +59,7 @@ class FilelockTest(BitcoinTestFramework):
if self.is_bdb_compiled(): if self.is_bdb_compiled():
check_wallet_filelock(False) check_wallet_filelock(False)
if self.is_sqlite_compiled(): check_wallet_filelock(True)
check_wallet_filelock(True)
if __name__ == '__main__': if __name__ == '__main__':
FilelockTest(__file__).main() FilelockTest(__file__).main()

View File

@ -59,7 +59,7 @@ class MempoolPersistTest(BitcoinTestFramework):
def run_test(self): def run_test(self):
self.mini_wallet = MiniWallet(self.nodes[2]) self.mini_wallet = MiniWallet(self.nodes[2])
if self.is_sqlite_compiled(): if self.is_wallet_compiled():
self.nodes[2].createwallet( self.nodes[2].createwallet(
wallet_name="watch", wallet_name="watch",
descriptors=True, descriptors=True,
@ -73,7 +73,7 @@ class MempoolPersistTest(BitcoinTestFramework):
tx_creation_time_lower = int(time.time()) tx_creation_time_lower = int(time.time())
for _ in range(5): for _ in range(5):
last_txid = self.mini_wallet.send_self_transfer(from_node=self.nodes[2])["txid"] 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 self.nodes[2].syncwithvalidationinterfacequeue() # Flush mempool to wallet
node2_balance = wallet_watch.getbalance() node2_balance = wallet_watch.getbalance()
self.sync_all() 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']) 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 # Verify accounting of mempool transactions after restart is correct
if self.is_sqlite_compiled(): if self.is_wallet_compiled():
self.nodes[2].loadwallet("watch") self.nodes[2].loadwallet("watch")
wallet_watch = self.nodes[2].get_wallet_rpc("watch") wallet_watch = self.nodes[2].get_wallet_rpc("watch")
self.nodes[2].syncwithvalidationinterfacequeue() # Flush mempool to wallet self.nodes[2].syncwithvalidationinterfacequeue() # Flush mempool to wallet

View File

@ -229,14 +229,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
# So set it to None to force -disablewallet, because the wallet is not needed. # So set it to None to force -disablewallet, because the wallet is not needed.
self.options.descriptors = None self.options.descriptors = None
elif self.options.descriptors is None: elif self.options.descriptors is None:
# Some wallet is either required or optionally used by the test. if self.is_wallet_compiled():
# Prefer SQLite unless it isn't available
if self.is_sqlite_compiled():
self.options.descriptors = True self.options.descriptors = True
elif self.is_bdb_compiled():
self.options.descriptors = False
else: 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. # 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. # So set it to None, which will also set -disablewallet.
self.options.descriptors = None self.options.descriptors = None
@ -966,16 +962,9 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
self._requires_wallet = True self._requires_wallet = True
if not self.is_wallet_compiled(): if not self.is_wallet_compiled():
raise SkipTest("wallet has not been compiled.") raise SkipTest("wallet has not been compiled.")
if self.options.descriptors: if not self.options.descriptors:
self.skip_if_no_sqlite()
else:
self.skip_if_no_bdb() 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): def skip_if_no_bdb(self):
"""Skip the running test if BDB has not been compiled.""" """Skip the running test if BDB has not been compiled."""
if not self.is_bdb_compiled(): if not self.is_bdb_compiled():
@ -1030,7 +1019,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
"""Checks whether wallet support for the specified type """Checks whether wallet support for the specified type
(legacy or descriptor wallet) was compiled.""" (legacy or descriptor wallet) was compiled."""
if self.options.descriptors: if self.options.descriptors:
return self.is_sqlite_compiled() return self.is_wallet_compiled()
else: else:
return self.is_bdb_compiled() return self.is_bdb_compiled()
@ -1050,10 +1039,6 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
"""Checks whether the USDT tracepoints were compiled.""" """Checks whether the USDT tracepoints were compiled."""
return self.config["components"].getboolean("ENABLE_USDT_TRACEPOINTS") 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): def is_bdb_compiled(self):
"""Checks whether the wallet module was compiled with BDB support.""" """Checks whether the wallet module was compiled with BDB support."""
return self.config["components"].getboolean("USE_BDB") return self.config["components"].getboolean("USE_BDB")

View File

@ -367,8 +367,7 @@ class ToolWalletTest(BitcoinTestFramework):
self.do_tool_createfromdump("load", "wallet.dump") self.do_tool_createfromdump("load", "wallet.dump")
if self.is_bdb_compiled(): if self.is_bdb_compiled():
self.do_tool_createfromdump("load-bdb", "wallet.dump", "bdb") 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') self.log.info('Checking createfromdump handling of magic and versions')
bad_ver_wallet_dump = self.nodes[0].datadir_path / "wallet-bad_ver1.dump" bad_ver_wallet_dump = self.nodes[0].datadir_path / "wallet-bad_ver1.dump"

View File

@ -127,7 +127,6 @@ class AddressInputTypeGrouping(BitcoinTestFramework):
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()
self.skip_if_no_sqlite()
def make_payment(self, A, B, v, addr_type): def make_payment(self, A, B, v, addr_type):
fee_rate = random.randint(1, 20) fee_rate = random.randint(1, 20)

View File

@ -33,7 +33,6 @@ class WalletDescriptorTest(BitcoinTestFramework):
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()
self.skip_if_no_sqlite()
self.skip_if_no_py_sqlite3() self.skip_if_no_py_sqlite3()
def test_concurrent_writes(self): def test_concurrent_writes(self):

View File

@ -28,7 +28,6 @@ class WalletFastRescanTest(BitcoinTestFramework):
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()
self.skip_if_no_sqlite()
def get_wallet_txids(self, node: TestNode, wallet_name: str) -> list[str]: def get_wallet_txids(self, node: TestNode, wallet_name: str) -> list[str]:
w = node.get_wallet_rpc(wallet_name) w = node.get_wallet_rpc(wallet_name)

View File

@ -47,7 +47,6 @@ class ImportDescriptorsTest(BitcoinTestFramework):
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() 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): def test_importdesc(self, req, success, error_code=None, error_message=None, warnings=None, wallet=None):
"""Run importdescriptors and assert success""" """Run importdescriptors and assert success"""

View File

@ -26,7 +26,6 @@ class ListDescriptorsTest(BitcoinTestFramework):
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()
self.skip_if_no_sqlite()
# do not create any wallet by default # do not create any wallet by default
def init_wallet(self, *, node): def init_wallet(self, *, node):

View File

@ -212,7 +212,6 @@ class WalletMiniscriptTest(BitcoinTestFramework):
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()
self.skip_if_no_sqlite()
def watchonly_test(self, desc): def watchonly_test(self, desc):
self.log.info(f"Importing descriptor '{desc}'") self.log.info(f"Importing descriptor '{desc}'")

View File

@ -29,7 +29,6 @@ class WalletMiniscriptDecayingMultisigDescriptorPSBTTest(BitcoinTestFramework):
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()
self.skip_if_no_sqlite()
@staticmethod @staticmethod
def _get_xpub(wallet, internal): def _get_xpub(wallet, internal):

View File

@ -26,7 +26,6 @@ class WalletMultisigDescriptorPSBTTest(BitcoinTestFramework):
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()
self.skip_if_no_sqlite()
@staticmethod @staticmethod
def _get_xpub(wallet, internal): def _get_xpub(wallet, internal):

View File

@ -24,7 +24,6 @@ class WalletRescanUnconfirmed(BitcoinTestFramework):
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()
self.skip_if_no_sqlite()
def run_test(self): def run_test(self):
self.log.info("Create wallets and mine initial chain") self.log.info("Create wallets and mine initial chain")

View File

@ -198,7 +198,6 @@ class WalletTaprootTest(BitcoinTestFramework):
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()
self.skip_if_no_sqlite()
def setup_network(self): def setup_network(self):
self.setup_nodes() self.setup_nodes()

View File

@ -343,16 +343,15 @@ class UpgradeWalletTest(BitcoinTestFramework):
v16_3_kvs = dump_bdb_kv(v16_3_wallet) v16_3_kvs = dump_bdb_kv(v16_3_wallet)
assert b'\x0adefaultkey' not in v16_3_kvs assert b'\x0adefaultkey' not in v16_3_kvs
if self.is_sqlite_compiled(): self.log.info("Checking that descriptor wallets do nothing, successfully")
self.log.info("Checking that descriptor wallets do nothing, successfully") self.nodes[0].createwallet(wallet_name="desc_upgrade", descriptors=True)
self.nodes[0].createwallet(wallet_name="desc_upgrade", descriptors=True) desc_wallet = self.nodes[0].get_wallet_rpc("desc_upgrade")
desc_wallet = self.nodes[0].get_wallet_rpc("desc_upgrade") self.test_upgradewallet(desc_wallet, previous_version=169900, expected_version=169900)
self.test_upgradewallet(desc_wallet, previous_version=169900, expected_version=169900)
self.log.info("Checking that descriptor wallets without privkeys do nothing, successfully") 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) 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") desc_wallet = self.nodes[0].get_wallet_rpc("desc_upgrade_nopriv")
self.test_upgradewallet(desc_wallet, previous_version=169900, expected_version=169900) self.test_upgradewallet(desc_wallet, previous_version=169900, expected_version=169900)
if self.is_bdb_compiled(): if self.is_bdb_compiled():
self.log.info("Upgrading a wallet with private keys disabled") self.log.info("Upgrading a wallet with private keys disabled")

View File

@ -11,6 +11,7 @@
"qt5", "qt5",
"tests", "tests",
"wallet", "wallet",
"berkeleydb",
"zeromq" "zeromq"
], ],
"features": { "features": {
@ -28,12 +29,6 @@
"libqrencode" "libqrencode"
] ]
}, },
"sqlite": {
"description": "Enable SQLite wallet support",
"dependencies": [
"sqlite3"
]
},
"tests": { "tests": {
"description": "Build test_bitcoin.exe executable", "description": "Build test_bitcoin.exe executable",
"dependencies": [ "dependencies": [
@ -41,9 +36,8 @@
] ]
}, },
"wallet": { "wallet": {
"description": "Enable wallet", "description": "Enable wallet (SQLite)",
"dependencies": [ "dependencies": [
"berkeleydb",
"sqlite3" "sqlite3"
] ]
}, },