mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-13 11:35:20 +01:00
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:
parent
502d47203e
commit
36b6f36ac4
40 changed files with 33 additions and 142 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -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:
|
||||
|
|
|
@ -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}")
|
||||
|
|
|
@ -83,7 +83,6 @@
|
|||
"WITH_BDB": "ON",
|
||||
"WITH_MULTIPROCESS": "ON",
|
||||
"WITH_QRENCODE": "ON",
|
||||
"WITH_SQLITE": "ON",
|
||||
"WITH_USDT": "ON",
|
||||
"WITH_ZMQ": "ON"
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)|' \
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 "")
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <bench/bench.h>
|
||||
#include <bitcoin-build-config.h> // IWYU pragma: keep
|
||||
#include <random.h>
|
||||
#include <support/allocators/secure.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 WalletCreateEncrypted(benchmark::Bench& bench) { WalletCreate(bench, /*encrypted=*/true); }
|
||||
|
||||
#ifdef USE_SQLITE
|
||||
BENCHMARK(WalletCreatePlain, benchmark::PriorityLevel::LOW);
|
||||
BENCHMARK(WalletCreateEncrypted, benchmark::PriorityLevel::LOW);
|
||||
#endif
|
||||
|
||||
} // namespace wallet
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <bitcoin-build-config.h> // IWYU pragma: keep
|
||||
|
||||
#include <bench/bench.h>
|
||||
#include <kernel/chain.h>
|
||||
#include <interfaces/chain.h>
|
||||
|
@ -17,8 +15,6 @@
|
|||
|
||||
#include <optional>
|
||||
|
||||
#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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
$<TARGET_NAME_IF_EXISTS:unofficial::sqlite3::sqlite3>
|
||||
$<TARGET_NAME_IF_EXISTS:SQLite::SQLite3>
|
||||
univalue
|
||||
Boost::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)
|
||||
target_sources(bitcoin_wallet PRIVATE bdb.cpp salvage.cpp)
|
||||
target_link_libraries(bitcoin_wallet PUBLIC BerkeleyDB::BerkeleyDB)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -403,9 +403,6 @@ static RPCHelpMan createwallet()
|
|||
flags |= WALLET_FLAG_AVOID_REUSE;
|
||||
}
|
||||
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;
|
||||
} else {
|
||||
if (!context.chain->rpcEnableDeprecated("create_bdb")) {
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
#ifdef USE_BDB
|
||||
#include <wallet/bdb.h>
|
||||
#endif
|
||||
#ifdef USE_SQLITE
|
||||
#include <wallet/sqlite.h>
|
||||
#endif
|
||||
#include <wallet/migrate.h>
|
||||
#include <wallet/test/util.h>
|
||||
#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
|
||||
dbs.emplace_back(std::make_unique<BerkeleyRODatabase>(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
|
||||
|
|
|
@ -8,8 +8,8 @@ target_sources(fuzz
|
|||
coinselection.cpp
|
||||
crypter.cpp
|
||||
fees.cpp
|
||||
$<$<BOOL:${USE_SQLITE}>:${CMAKE_CURRENT_LIST_DIR}/notifications.cpp>
|
||||
$<$<BOOL:${USE_SQLITE}>:${CMAKE_CURRENT_LIST_DIR}/scriptpubkeyman.cpp>
|
||||
notifications.cpp
|
||||
scriptpubkeyman.cpp
|
||||
spend.cpp
|
||||
wallet_bdb_parser.cpp
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
#include <wallet/bdb.h>
|
||||
#endif
|
||||
#include <wallet/migrate.h>
|
||||
#ifdef USE_SQLITE
|
||||
#include <wallet/sqlite.h>
|
||||
#endif
|
||||
#include <wallet/wallet.h>
|
||||
|
||||
#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 (!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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"""
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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}'")
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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")
|
||||
|
|
10
vcpkg.json
10
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"
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue