Skip to content

Commit 717103b

Browse files
committed
Merge bitcoin/bitcoin#29315: refactor: Compile unreachable walletdb code
fa3373d refactor: Compile unreachable code (MarcoFalke) Pull request description: When unreachable code isn't compiled, compile failures are not detected. Fix this by leaving it unreachable, but compiling it. Fixes bitcoin/bitcoin#28999 (comment) ACKs for top commit: achow101: ACK fa3373d ryanofsky: Code review ACK fa3373d. This looks good, and should prevent code in the else blocks from accidentally breaking. Tree-SHA512: 3a3764915dfc935bf5d7a48f1ca151dcbac340c1cbdce8236b24ae9b4f04d6ee9771ed058ca60bcbca6e19d13671de3517f828a8f7ab6444c7cc4e3538d1ba4e
2 parents 3672099 + fa3373d commit 717103b

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/wallet/walletdb.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,20 +1498,26 @@ std::unique_ptr<WalletDatabase> MakeDatabase(const fs::path& path, const Databas
14981498

14991499
if (format == DatabaseFormat::SQLITE) {
15001500
#ifdef USE_SQLITE
1501-
return MakeSQLiteDatabase(path, options, status, error);
1502-
#else
1503-
error = Untranslated(strprintf("Failed to open database path '%s'. Build does not support SQLite database format.", fs::PathToString(path)));
1504-
status = DatabaseStatus::FAILED_BAD_FORMAT;
1505-
return nullptr;
1501+
if constexpr (true) {
1502+
return MakeSQLiteDatabase(path, options, status, error);
1503+
} else
15061504
#endif
1505+
{
1506+
error = Untranslated(strprintf("Failed to open database path '%s'. Build does not support SQLite database format.", fs::PathToString(path)));
1507+
status = DatabaseStatus::FAILED_BAD_FORMAT;
1508+
return nullptr;
1509+
}
15071510
}
15081511

15091512
#ifdef USE_BDB
1510-
return MakeBerkeleyDatabase(path, options, status, error);
1511-
#else
1512-
error = Untranslated(strprintf("Failed to open database path '%s'. Build does not support Berkeley DB database format.", fs::PathToString(path)));
1513-
status = DatabaseStatus::FAILED_BAD_FORMAT;
1514-
return nullptr;
1513+
if constexpr (true) {
1514+
return MakeBerkeleyDatabase(path, options, status, error);
1515+
} else
15151516
#endif
1517+
{
1518+
error = Untranslated(strprintf("Failed to open database path '%s'. Build does not support Berkeley DB database format.", fs::PathToString(path)));
1519+
status = DatabaseStatus::FAILED_BAD_FORMAT;
1520+
return nullptr;
1521+
}
15161522
}
15171523
} // namespace wallet

0 commit comments

Comments
 (0)