aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorRyan Ofsky <ryan@ofsky.org>2022-06-07 21:08:56 -0400
committerRyan Ofsky <ryan@ofsky.org>2022-07-19 16:54:52 -0400
commit6db6552377ad6316626b3ab8605a98f96f22c3d2 (patch)
tree02a4dbcf56b2daf1c1b8123944c4d337f1a7f8aa /src/init.cpp
parentb3e7de7ee6efb186efc272855ff1af5d9254b971 (diff)
downloadbitcoin-6db6552377ad6316626b3ab8605a98f96f22c3d2.tar.xz
refactor: Reduce number of SanityChecks return values
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/init.cpp b/src/init.cpp
index b80c171f11..a94bbe6460 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1096,21 +1096,8 @@ static bool LockDataDirectory(bool probeOnly)
bool AppInitSanityChecks(const kernel::Context& kernel)
{
// ********************************************************* Step 4: sanity checks
- auto maybe_error = kernel::SanityChecks(kernel);
-
- if (maybe_error.has_value()) {
- switch (maybe_error.value()) {
- case kernel::SanityCheckError::ERROR_ECC:
- InitError(Untranslated("Elliptic curve cryptography sanity check failure. Aborting."));
- break;
- case kernel::SanityCheckError::ERROR_RANDOM:
- InitError(Untranslated("OS cryptographic RNG sanity check failure. Aborting."));
- break;
- case kernel::SanityCheckError::ERROR_CHRONO:
- InitError(Untranslated("Clock epoch mismatch. Aborting."));
- break;
- } // no default case, so the compiler can warn about missing cases
-
+ if (auto error = kernel::SanityChecks(kernel)) {
+ InitError(*error);
return InitError(strprintf(_("Initialization sanity check failed. %s is shutting down."), PACKAGE_NAME));
}