diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2020-10-15 13:50:00 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2020-10-20 13:44:43 +0000 |
commit | 7b54d768e1514b328e1ac108d3db2f1bac3ba7ff (patch) | |
tree | ace67c61cc90f8b2dabbf5dbf47cdd2cf13404e5 /src | |
parent | 711ddce94377aea38ce30fa93b3ee8ea1d96ba98 (diff) | |
download | bitcoin-7b54d768e1514b328e1ac108d3db2f1bac3ba7ff.tar.xz |
Make sqlite support optional (compile-time)
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 7 | ||||
-rw-r--r-- | src/wallet/walletdb.cpp | 8 | ||||
-rw-r--r-- | src/wallet/walletutil.cpp | 4 |
3 files changed, 17 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index b0d36717ce..67fd402603 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -356,7 +356,7 @@ endif # wallet: shared between bitcoind and bitcoin-qt, but only linked # when wallet enabled -libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) +libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(SQLITE_CFLAGS) libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_wallet_a_SOURCES = \ interfaces/wallet.cpp \ @@ -372,13 +372,16 @@ libbitcoin_wallet_a_SOURCES = \ wallet/rpcwallet.cpp \ wallet/salvage.cpp \ wallet/scriptpubkeyman.cpp \ - wallet/sqlite.cpp \ wallet/wallet.cpp \ wallet/walletdb.cpp \ wallet/walletutil.cpp \ wallet/coinselection.cpp \ $(BITCOIN_CORE_H) +if USE_SQLITE +libbitcoin_wallet_a_SOURCES += wallet/sqlite.cpp +endif + libbitcoin_wallet_tool_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) libbitcoin_wallet_tool_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_wallet_tool_a_SOURCES = \ diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index 0092a29cb4..aa3b3c10b0 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -15,7 +15,9 @@ #include <util/time.h> #include <util/translation.h> #include <wallet/bdb.h> +#ifdef USE_SQLITE #include <wallet/sqlite.h> +#endif #include <wallet/wallet.h> #include <atomic> @@ -1012,6 +1014,7 @@ std::unique_ptr<WalletDatabase> MakeDatabase(const fs::path& path, const Databas if (ExistsBerkeleyDatabase(path)) { format = DatabaseFormat::BERKELEY; } +#ifdef USE_SQLITE if (ExistsSQLiteDatabase(path)) { if (format) { error = Untranslated(strprintf("Failed to load database path '%s'. Data is in ambiguous format.", path.string())); @@ -1020,6 +1023,7 @@ std::unique_ptr<WalletDatabase> MakeDatabase(const fs::path& path, const Databas } format = DatabaseFormat::SQLITE; } +#endif } else if (options.require_existing) { error = Untranslated(strprintf("Failed to load database path '%s'. Path does not exist.", path.string())); status = DatabaseStatus::FAILED_NOT_FOUND; @@ -1048,9 +1052,13 @@ std::unique_ptr<WalletDatabase> MakeDatabase(const fs::path& path, const Databas // Format is not set when a db doesn't already exist, so use the format specified by the options if it is set. if (!format && options.require_format) format = options.require_format; +#ifdef USE_SQLITE if (format && format == DatabaseFormat::SQLITE) { return MakeSQLiteDatabase(path, options, status, error); } +#else + assert(format != DatabaseFormat::SQLITE); +#endif return MakeBerkeleyDatabase(path, options, status, error); } diff --git a/src/wallet/walletutil.cpp b/src/wallet/walletutil.cpp index a2a55f9751..2f3e597b90 100644 --- a/src/wallet/walletutil.cpp +++ b/src/wallet/walletutil.cpp @@ -8,7 +8,11 @@ #include <util/system.h> bool ExistsBerkeleyDatabase(const fs::path& path); +#ifdef USE_SQLITE bool ExistsSQLiteDatabase(const fs::path& path); +#else +# define ExistsSQLiteDatabase(path) (false) +#endif fs::path GetWalletDir() { |