diff options
author | fanquake <fanquake@gmail.com> | 2022-06-04 20:22:40 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2022-06-04 20:25:57 +0100 |
commit | aac9c259b045e3238fe4293141e29ab8f2e60f8d (patch) | |
tree | 05289cac170931822c7b8f6ac5cde58c111b0bf0 /src/test/util | |
parent | 2cf8c2caea90d9a3c314ba5f88bb76b3b5273d62 (diff) | |
parent | d87784ac87364fc977bbf9769c8bdb72dea8cbf9 (diff) | |
download | bitcoin-aac9c259b045e3238fe4293141e29ab8f2e60f8d.tar.xz |
Merge bitcoin/bitcoin#25065: [kernel 2c/n] Introduce `kernel::Context`, encapsulate global init/teardown
d87784ac87364fc977bbf9769c8bdb72dea8cbf9 kernel: SanityChecks: Return an error struct (Carl Dong)
265d6393bf9ef52e7ef7de97ca9c031da82a5ad1 Move init::SanityCheck to kernel::SanityCheck (Carl Dong)
fed085a1a4cd2787202752b6a0d98e42dce97f09 init: Initialize globals with kernel::Context's life (Carl Dong)
7d03feef8156ef37a4efa01dc591467bc7d957bf kernel: Introduce empty and unused kernel::Context (Carl Dong)
eeb4fc20c578b1e428a92d64cc9f8f903a677580 test: Use Set/UnsetGlobals in BasicTestingSetup (Carl Dong)
Pull request description:
The full `init/common.cpp` is dependent on things like ArgsManager (which we wish to remove from libbitcoinkernel in the future) and sanity checks. These aren't necessary for libbitcoinkernel so we only extract the portion that is necessary (namely `init::{Set,Unset}Globals()`.
ACKs for top commit:
theuni:
ACK d87784ac87364fc977bbf9769c8bdb72dea8cbf9
vasild:
ACK d87784ac87364fc977bbf9769c8bdb72dea8cbf9
Tree-SHA512: cd6b4923ea1865001b5f0caed9a4ff99c198d22bf74154d935dc09a47fda22ebe585ec912398cea69f722454ed1dbb4898faab5a2d02fb4c5e719c5c8d71a3f9
Diffstat (limited to 'src/test/util')
-rw-r--r-- | src/test/util/setup_common.cpp | 5 | ||||
-rw-r--r-- | src/test/util/setup_common.h | 3 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 01f41ccf82..8f03481f72 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -12,6 +12,7 @@ #include <consensus/validation.h> #include <crypto/sha256.h> #include <init.h> +#include <init/common.h> #include <interfaces/chain.h> #include <net.h> #include <net_processing.h> @@ -126,8 +127,7 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::ve InitLogging(*m_node.args); AppInitParameterInteraction(*m_node.args); LogInstance().StartLogging(); - SHA256AutoDetect(); - ECC_Start(); + m_node.kernel = std::make_unique<kernel::Context>(); SetupEnvironment(); SetupNetworking(); InitSignatureCache(); @@ -147,7 +147,6 @@ BasicTestingSetup::~BasicTestingSetup() LogInstance().DisconnectTestLogger(); fs::remove_all(m_path_root); gArgs.ClearArgs(); - ECC_Stop(); } ChainTestingSetup::ChainTestingSetup(const std::string& chainName, const std::vector<const char*>& extra_args) diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h index 4270eb18c6..37407bcb92 100644 --- a/src/test/util/setup_common.h +++ b/src/test/util/setup_common.h @@ -81,8 +81,7 @@ static constexpr CAmount CENT{1000000}; * This just configures logging, data dir and chain parameters. */ struct BasicTestingSetup { - ECCVerifyHandle globalVerifyHandle; - node::NodeContext m_node; + node::NodeContext m_node; // keep as first member to be destructed last explicit BasicTestingSetup(const std::string& chainName = CBaseChainParams::MAIN, const std::vector<const char*>& extra_args = {}); ~BasicTestingSetup(); |