File tree Expand file tree Collapse file tree 3 files changed +10
-26
lines changed Expand file tree Collapse file tree 3 files changed +10
-26
lines changed Original file line number Diff line number Diff line change @@ -1096,21 +1096,8 @@ static bool LockDataDirectory(bool probeOnly)
10961096bool AppInitSanityChecks (const kernel::Context& kernel)
10971097{
10981098 // ********************************************************* Step 4: sanity checks
1099- auto maybe_error = kernel::SanityChecks (kernel);
1100-
1101- if (maybe_error.has_value ()) {
1102- switch (maybe_error.value ()) {
1103- case kernel::SanityCheckError::ERROR_ECC:
1104- InitError (Untranslated (" Elliptic curve cryptography sanity check failure. Aborting." ));
1105- break ;
1106- case kernel::SanityCheckError::ERROR_RANDOM:
1107- InitError (Untranslated (" OS cryptographic RNG sanity check failure. Aborting." ));
1108- break ;
1109- case kernel::SanityCheckError::ERROR_CHRONO:
1110- InitError (Untranslated (" Clock epoch mismatch. Aborting." ));
1111- break ;
1112- } // no default case, so the compiler can warn about missing cases
1113-
1099+ if (auto error = kernel::SanityChecks (kernel)) {
1100+ InitError (*error);
11141101 return InitError (strprintf (_ (" Initialization sanity check failed. %s is shutting down." ), PACKAGE_NAME));
11151102 }
11161103
Original file line number Diff line number Diff line change 77#include < key.h>
88#include < random.h>
99#include < util/time.h>
10+ #include < util/translation.h>
1011
1112namespace kernel {
1213
13- std::optional<SanityCheckError > SanityChecks (const Context&)
14+ std::optional<bilingual_str > SanityChecks (const Context&)
1415{
1516 if (!ECC_InitSanityCheck ()) {
16- return SanityCheckError::ERROR_ECC ;
17+ return Untranslated ( " Elliptic curve cryptography sanity check failure. Aborting. " ) ;
1718 }
1819
1920 if (!Random_SanityCheck ()) {
20- return SanityCheckError::ERROR_RANDOM ;
21+ return Untranslated ( " OS cryptographic RNG sanity check failure. Aborting. " ) ;
2122 }
2223
2324 if (!ChronoSanityCheck ()) {
24- return SanityCheckError::ERROR_CHRONO ;
25+ return Untranslated ( " Clock epoch mismatch. Aborting. " ) ;
2526 }
2627
2728 return std::nullopt ;
Original file line number Diff line number Diff line change 77
88#include < optional>
99
10+ struct bilingual_str ;
11+
1012namespace kernel {
1113
1214struct Context ;
1315
14- enum class SanityCheckError {
15- ERROR_ECC,
16- ERROR_RANDOM,
17- ERROR_CHRONO,
18- };
19-
2016/* *
2117 * Ensure a usable environment with all necessary library support.
2218 */
23- std::optional<SanityCheckError > SanityChecks (const Context&);
19+ std::optional<bilingual_str > SanityChecks (const Context&);
2420
2521}
2622
You can’t perform that action at this time.
0 commit comments