diff --git a/src/kernel/context.cpp b/src/kernel/context.cpp index bfb17915fd..2420d18d74 100644 --- a/src/kernel/context.cpp +++ b/src/kernel/context.cpp @@ -8,15 +8,18 @@ #include #include +#include #include - namespace kernel { Context::Context() { - std::string sha256_algo = SHA256AutoDetect(); - LogPrintf("Using the '%s' SHA256 implementation\n", sha256_algo); - RandomInit(); + static std::once_flag globals_initialized{}; + std::call_once(globals_initialized, []() { + std::string sha256_algo = SHA256AutoDetect(); + LogInfo("Using the '%s' SHA256 implementation\n", sha256_algo); + RandomInit(); + }); }