aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/walletdb.cpp
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-01-25 13:46:58 +0100
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-01-25 16:25:55 +0100
commitfa3373d3adbace7e4665cf391363319a55a09a96 (patch)
tree96f899c450772629a55fe10579b0c13caa1e9a8f /src/wallet/walletdb.cpp
parent4ad83ef09b772f3f1e8ea9ea3a8c43dcd9db8458 (diff)
downloadbitcoin-fa3373d3adbace7e4665cf391363319a55a09a96.tar.xz
refactor: Compile unreachable code
When unreachable code isn't compiled, compile failures are not detected. Fix this by leaving it unreachable, but compiling it. Fixes https://github.com/bitcoin/bitcoin/pull/28999#discussion_r1465010916 Can be reviewed with --ignore-all-space
Diffstat (limited to 'src/wallet/walletdb.cpp')
-rw-r--r--src/wallet/walletdb.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp
index 9820c7c0ee..f3dd5b328e 100644
--- a/src/wallet/walletdb.cpp
+++ b/src/wallet/walletdb.cpp
@@ -1498,20 +1498,26 @@ std::unique_ptr<WalletDatabase> MakeDatabase(const fs::path& path, const Databas
if (format == DatabaseFormat::SQLITE) {
#ifdef USE_SQLITE
- return MakeSQLiteDatabase(path, options, status, error);
-#else
- 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 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;
+ }
}
#ifdef USE_BDB
- return MakeBerkeleyDatabase(path, options, status, error);
-#else
- error = Untranslated(strprintf("Failed to open database path '%s'. Build does not support Berkeley DB database format.", fs::PathToString(path)));
- status = DatabaseStatus::FAILED_BAD_FORMAT;
- return nullptr;
+ if constexpr (true) {
+ return MakeBerkeleyDatabase(path, options, status, error);
+ } else
#endif
+ {
+ error = Untranslated(strprintf("Failed to open database path '%s'. Build does not support Berkeley DB database format.", fs::PathToString(path)));
+ status = DatabaseStatus::FAILED_BAD_FORMAT;
+ return nullptr;
+ }
}
} // namespace wallet