diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2016-04-16 14:47:18 -0400 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2016-09-08 12:04:35 -0400 |
commit | cd16f48028f54327d4afba9c1f91f25d0b072aa5 (patch) | |
tree | 898569d833ac7d3f40e6cf3129262321894ac6db /src/test | |
parent | d93b14dc5ddfb937b0cc18be425b9d048cefb66b (diff) |
net: Create CConnman to encapsulate p2p connections
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_bitcoin.cpp | 6 | ||||
-rw-r--r-- | src/test/test_bitcoin.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index 056f2982cf..ed74418e34 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -26,6 +26,8 @@ #include <boost/test/unit_test.hpp> #include <boost/thread.hpp> +std::unique_ptr<CConnman> g_connman; + extern bool fPrintToConsole; extern void noui_connect(); @@ -43,6 +45,7 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName) BasicTestingSetup::~BasicTestingSetup() { ECC_Stop(); + g_connman.reset(); } TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(chainName) @@ -50,6 +53,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. + RegisterAllCoreRPCCommands(tableRPC); ClearDatadirCache(); pathTemp = GetTempPath() / strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000))); @@ -68,6 +72,8 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha nScriptCheckThreads = 3; for (int i=0; i < nScriptCheckThreads-1; i++) threadGroup.create_thread(&ThreadScriptCheck); + g_connman = std::unique_ptr<CConnman>(new CConnman()); + connman = g_connman.get(); RegisterNodeSignals(GetNodeSignals()); } diff --git a/src/test/test_bitcoin.h b/src/test/test_bitcoin.h index bc0d2fe316..9819a7097d 100644 --- a/src/test/test_bitcoin.h +++ b/src/test/test_bitcoin.h @@ -27,10 +27,12 @@ struct BasicTestingSetup { /** Testing setup that configures a complete environment. * Included are data directory, coins database, script check threads setup. */ +class CConnman; struct TestingSetup: public BasicTestingSetup { CCoinsViewDB *pcoinsdbview; boost::filesystem::path pathTemp; boost::thread_group threadGroup; + CConnman* connman; TestingSetup(const std::string& chainName = CBaseChainParams::MAIN); ~TestingSetup(); |