aboutsummaryrefslogtreecommitdiff
path: root/src/test/setup_common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/setup_common.cpp')
-rw-r--r--src/test/setup_common.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/test/setup_common.cpp b/src/test/setup_common.cpp
index bbdf1ef830..3425bd59c1 100644
--- a/src/test/setup_common.cpp
+++ b/src/test/setup_common.cpp
@@ -15,6 +15,7 @@
#include <net.h>
#include <noui.h>
#include <pow.h>
+#include <rpc/blockchain.h>
#include <rpc/register.h>
#include <rpc/server.h>
#include <script/sigcache.h>
@@ -76,6 +77,7 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
const CChainParams& chainparams = Params();
// Ideally we'd move all the RPC tests to the functional testing framework
// instead of unit tests, but for now we need these here.
+ g_rpc_node = &m_node;
RegisterAllCoreRPCCommands(tableRPC);
// We have to run a scheduler thread to prevent ActivateBestChain
@@ -95,7 +97,7 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
throw std::runtime_error("LoadGenesisBlock failed.");
}
- CValidationState state;
+ BlockValidationState state;
if (!ActivateBestChain(state, chainparams)) {
throw std::runtime_error(strprintf("ActivateBestChain failed. (%s)", FormatStateMessage(state)));
}
@@ -104,8 +106,8 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
for (int i = 0; i < nScriptCheckThreads - 1; i++)
threadGroup.create_thread([i]() { return ThreadScriptCheck(i); });
- g_banman = MakeUnique<BanMan>(GetDataDir() / "banlist.dat", nullptr, DEFAULT_MISBEHAVING_BANTIME);
- g_connman = MakeUnique<CConnman>(0x1337, 0x1337); // Deterministic randomness for tests.
+ m_node.banman = MakeUnique<BanMan>(GetDataDir() / "banlist.dat", nullptr, DEFAULT_MISBEHAVING_BANTIME);
+ m_node.connman = MakeUnique<CConnman>(0x1337, 0x1337); // Deterministic randomness for tests.
}
TestingSetup::~TestingSetup()
@@ -114,8 +116,9 @@ TestingSetup::~TestingSetup()
threadGroup.join_all();
GetMainSignals().FlushBackgroundCallbacks();
GetMainSignals().UnregisterBackgroundSignalScheduler();
- g_connman.reset();
- g_banman.reset();
+ g_rpc_node = nullptr;
+ m_node.connman.reset();
+ m_node.banman.reset();
UnloadBlockIndex();
g_chainstate.reset();
pblocktree.reset();