mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 00:34:01 +02:00
Give CMainSignals a reference to the global scheduler
...so that it can run some signals in the background later
This commit is contained in:
@@ -62,6 +62,12 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
|
||||
pathTemp = GetTempPath() / strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(InsecureRandRange(100000)));
|
||||
fs::create_directories(pathTemp);
|
||||
ForceSetArg("-datadir", pathTemp.string());
|
||||
|
||||
// Note that because we don't bother running a scheduler thread here,
|
||||
// callbacks via CValidationInterface are unreliable, but that's OK,
|
||||
// our unit tests aren't testing multiple parts of the code at once.
|
||||
GetMainSignals().RegisterBackgroundSignalScheduler(scheduler);
|
||||
|
||||
mempool.setSanityCheck(1.0);
|
||||
pblocktree = new CBlockTreeDB(1 << 20, true);
|
||||
pcoinsdbview = new CCoinsViewDB(1 << 23, true);
|
||||
@@ -88,6 +94,7 @@ TestingSetup::~TestingSetup()
|
||||
UnregisterNodeSignals(GetNodeSignals());
|
||||
threadGroup.interrupt_all();
|
||||
threadGroup.join_all();
|
||||
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
||||
UnloadBlockIndex();
|
||||
delete pcoinsTip;
|
||||
delete pcoinsdbview;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "key.h"
|
||||
#include "pubkey.h"
|
||||
#include "random.h"
|
||||
#include "scheduler.h"
|
||||
#include "txdb.h"
|
||||
#include "txmempool.h"
|
||||
|
||||
@@ -53,6 +54,7 @@ struct TestingSetup: public BasicTestingSetup {
|
||||
fs::path pathTemp;
|
||||
boost::thread_group threadGroup;
|
||||
CConnman* connman;
|
||||
CScheduler scheduler;
|
||||
|
||||
TestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
|
||||
~TestingSetup();
|
||||
|
||||
Reference in New Issue
Block a user