Skip to content

Commit eeb4fc2

Browse files
committed
test: Use Set/UnsetGlobals in BasicTestingSetup
...instead of calling initialization functions directly and having to keep around a ECCVerifyHandle member variable. This makes the initialization codepath of our tests more closely resemble those of AppInitMain and potentially eases the review of subsequent commit removing init::{Set,Unset}Globals. [META] In a future commit, we will introduce a kernel::Context which calls init::{Set,Unset}Globals in its ctor and dtor. It will be owned by node::NodeContext, so in the end, this patchset won't have made the previously local ECCVerifyHandle global.
1 parent d4d9daf commit eeb4fc2

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/test/util/setup_common.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <consensus/validation.h>
1313
#include <crypto/sha256.h>
1414
#include <init.h>
15+
#include <init/common.h>
1516
#include <interfaces/chain.h>
1617
#include <net.h>
1718
#include <net_processing.h>
@@ -125,8 +126,7 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::ve
125126
InitLogging(*m_node.args);
126127
AppInitParameterInteraction(*m_node.args);
127128
LogInstance().StartLogging();
128-
SHA256AutoDetect();
129-
ECC_Start();
129+
init::SetGlobals();
130130
SetupEnvironment();
131131
SetupNetworking();
132132
InitSignatureCache();
@@ -146,7 +146,7 @@ BasicTestingSetup::~BasicTestingSetup()
146146
LogInstance().DisconnectTestLogger();
147147
fs::remove_all(m_path_root);
148148
gArgs.ClearArgs();
149-
ECC_Stop();
149+
init::UnsetGlobals();
150150
}
151151

152152
ChainTestingSetup::ChainTestingSetup(const std::string& chainName, const std::vector<const char*>& extra_args)

src/test/util/setup_common.h

-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ static constexpr CAmount CENT{1000000};
8181
* This just configures logging, data dir and chain parameters.
8282
*/
8383
struct BasicTestingSetup {
84-
ECCVerifyHandle globalVerifyHandle;
8584
node::NodeContext m_node;
8685

8786
explicit BasicTestingSetup(const std::string& chainName = CBaseChainParams::MAIN, const std::vector<const char*>& extra_args = {});

0 commit comments

Comments
 (0)