mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-12 18:44:59 +01:00
This change helps generalize shutdown code so an interrupt can be provided to libbitcoinkernel callers. This may also be useful to eventually de-globalize all of the shutdown code. Co-authored-by: Russell Yanofsky <russ@yanofsky.org> Co-authored-by: TheCharlatan <seb.kung@gmail.com>
36 lines
721 B
C++
36 lines
721 B
C++
// Copyright (c) 2022 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include <kernel/context.h>
|
|
|
|
#include <crypto/sha256.h>
|
|
#include <key.h>
|
|
#include <logging.h>
|
|
#include <pubkey.h>
|
|
#include <random.h>
|
|
|
|
#include <string>
|
|
|
|
|
|
namespace kernel {
|
|
Context* g_context;
|
|
|
|
Context::Context()
|
|
{
|
|
assert(!g_context);
|
|
g_context = this;
|
|
std::string sha256_algo = SHA256AutoDetect();
|
|
LogPrintf("Using the '%s' SHA256 implementation\n", sha256_algo);
|
|
RandomInit();
|
|
ECC_Start();
|
|
}
|
|
|
|
Context::~Context()
|
|
{
|
|
ECC_Stop();
|
|
assert(g_context);
|
|
g_context = nullptr;
|
|
}
|
|
|
|
} // namespace kernel
|