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)
1096
1096
bool AppInitSanityChecks (const kernel::Context& kernel)
1097
1097
{
1098
1098
// ********************************************************* 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);
1114
1101
return InitError (strprintf (_ (" Initialization sanity check failed. %s is shutting down." ), PACKAGE_NAME));
1115
1102
}
1116
1103
Original file line number Diff line number Diff line change 7
7
#include < key.h>
8
8
#include < random.h>
9
9
#include < util/time.h>
10
+ #include < util/translation.h>
10
11
11
12
namespace kernel {
12
13
13
- std::optional<SanityCheckError > SanityChecks (const Context&)
14
+ std::optional<bilingual_str > SanityChecks (const Context&)
14
15
{
15
16
if (!ECC_InitSanityCheck ()) {
16
- return SanityCheckError::ERROR_ECC ;
17
+ return Untranslated ( " Elliptic curve cryptography sanity check failure. Aborting. " ) ;
17
18
}
18
19
19
20
if (!Random_SanityCheck ()) {
20
- return SanityCheckError::ERROR_RANDOM ;
21
+ return Untranslated ( " OS cryptographic RNG sanity check failure. Aborting. " ) ;
21
22
}
22
23
23
24
if (!ChronoSanityCheck ()) {
24
- return SanityCheckError::ERROR_CHRONO ;
25
+ return Untranslated ( " Clock epoch mismatch. Aborting. " ) ;
25
26
}
26
27
27
28
return std::nullopt;
Original file line number Diff line number Diff line change 7
7
8
8
#include < optional>
9
9
10
+ struct bilingual_str ;
11
+
10
12
namespace kernel {
11
13
12
14
struct Context ;
13
15
14
- enum class SanityCheckError {
15
- ERROR_ECC,
16
- ERROR_RANDOM,
17
- ERROR_CHRONO,
18
- };
19
-
20
16
/* *
21
17
* Ensure a usable environment with all necessary library support.
22
18
*/
23
- std::optional<SanityCheckError > SanityChecks (const Context&);
19
+ std::optional<bilingual_str > SanityChecks (const Context&);
24
20
25
21
}
26
22
You can’t perform that action at this time.
0 commit comments