mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-31 14:51:23 +02:00
Merge bitcoin/bitcoin#29315: refactor: Compile unreachable walletdb code
fa3373d3ad
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 https://github.com/bitcoin/bitcoin/pull/28999#discussion_r1465010916 ACKs for top commit: achow101: ACKfa3373d3ad
ryanofsky: Code review ACKfa3373d3ad
. This looks good, and should prevent code in the else blocks from accidentally breaking. Tree-SHA512: 3a3764915dfc935bf5d7a48f1ca151dcbac340c1cbdce8236b24ae9b4f04d6ee9771ed058ca60bcbca6e19d13671de3517f828a8f7ab6444c7cc4e3538d1ba4e
This commit is contained in:
@@ -1498,20 +1498,26 @@ std::unique_ptr<WalletDatabase> MakeDatabase(const fs::path& path, const Databas
|
|||||||
|
|
||||||
if (format == DatabaseFormat::SQLITE) {
|
if (format == DatabaseFormat::SQLITE) {
|
||||||
#ifdef USE_SQLITE
|
#ifdef USE_SQLITE
|
||||||
return MakeSQLiteDatabase(path, options, status, error);
|
if constexpr (true) {
|
||||||
#else
|
return MakeSQLiteDatabase(path, options, status, error);
|
||||||
error = Untranslated(strprintf("Failed to open database path '%s'. Build does not support SQLite database format.", fs::PathToString(path)));
|
} else
|
||||||
status = DatabaseStatus::FAILED_BAD_FORMAT;
|
|
||||||
return nullptr;
|
|
||||||
#endif
|
#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
|
#ifdef USE_BDB
|
||||||
return MakeBerkeleyDatabase(path, options, status, error);
|
if constexpr (true) {
|
||||||
#else
|
return MakeBerkeleyDatabase(path, options, status, error);
|
||||||
error = Untranslated(strprintf("Failed to open database path '%s'. Build does not support Berkeley DB database format.", fs::PathToString(path)));
|
} else
|
||||||
status = DatabaseStatus::FAILED_BAD_FORMAT;
|
|
||||||
return nullptr;
|
|
||||||
#endif
|
#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
|
} // namespace wallet
|
||||||
|
Reference in New Issue
Block a user