aboutsummaryrefslogtreecommitdiff
path: root/src/test/util/setup_common.cpp
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2022-05-25 14:31:54 -0400
committerCarl Dong <contact@carldong.me>2022-06-02 11:40:03 -0400
commitfed085a1a4cd2787202752b6a0d98e42dce97f09 (patch)
treef5f85da84e9aee2a1e7fd6ac52edf70dfa90fcbd /src/test/util/setup_common.cpp
parent7d03feef8156ef37a4efa01dc591467bc7d957bf (diff)
downloadbitcoin-fed085a1a4cd2787202752b6a0d98e42dce97f09.tar.xz
init: Initialize globals with kernel::Context's life
...instead of explicitly calling init::{Set,Unset}Globals. Cool thing about this is that in both the testing and bitcoin-chainstate codepaths, we no longer need to explicitly unset globals. The kernel::Context goes out of scope and the globals are unset "automatically". Also construct kernel::Context outside of AppInitSanityChecks()
Diffstat (limited to 'src/test/util/setup_common.cpp')
-rw-r--r--src/test/util/setup_common.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp
index 7b70ace759..61af5d4418 100644
--- a/src/test/util/setup_common.cpp
+++ b/src/test/util/setup_common.cpp
@@ -126,7 +126,7 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::ve
InitLogging(*m_node.args);
AppInitParameterInteraction(*m_node.args);
LogInstance().StartLogging();
- init::SetGlobals();
+ m_node.kernel = std::make_unique<kernel::Context>();
SetupEnvironment();
SetupNetworking();
InitSignatureCache();
@@ -146,7 +146,6 @@ BasicTestingSetup::~BasicTestingSetup()
LogInstance().DisconnectTestLogger();
fs::remove_all(m_path_root);
gArgs.ClearArgs();
- init::UnsetGlobals();
}
ChainTestingSetup::ChainTestingSetup(const std::string& chainName, const std::vector<const char*>& extra_args)