mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
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.
This commit is contained in:
parent
d4d9daff7a
commit
eeb4fc20c5
2 changed files with 3 additions and 4 deletions
|
@ -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>
|
||||
|
@ -125,8 +126,7 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::ve
|
|||
InitLogging(*m_node.args);
|
||||
AppInitParameterInteraction(*m_node.args);
|
||||
LogInstance().StartLogging();
|
||||
SHA256AutoDetect();
|
||||
ECC_Start();
|
||||
init::SetGlobals();
|
||||
SetupEnvironment();
|
||||
SetupNetworking();
|
||||
InitSignatureCache();
|
||||
|
@ -146,7 +146,7 @@ BasicTestingSetup::~BasicTestingSetup()
|
|||
LogInstance().DisconnectTestLogger();
|
||||
fs::remove_all(m_path_root);
|
||||
gArgs.ClearArgs();
|
||||
ECC_Stop();
|
||||
init::UnsetGlobals();
|
||||
}
|
||||
|
||||
ChainTestingSetup::ChainTestingSetup(const std::string& chainName, const std::vector<const char*>& extra_args)
|
||||
|
|
|
@ -81,7 +81,6 @@ static constexpr CAmount CENT{1000000};
|
|||
* This just configures logging, data dir and chain parameters.
|
||||
*/
|
||||
struct BasicTestingSetup {
|
||||
ECCVerifyHandle globalVerifyHandle;
|
||||
node::NodeContext m_node;
|
||||
|
||||
explicit BasicTestingSetup(const std::string& chainName = CBaseChainParams::MAIN, const std::vector<const char*>& extra_args = {});
|
||||
|
|
Loading…
Reference in a new issue