From 4ae29f5f0c5117032debb722d7049664fdceeae8 Mon Sep 17 00:00:00 2001 From: James O'Beirne Date: Thu, 12 Dec 2019 10:48:28 -0500 Subject: use ChainstateManager to initialize chainstate This allows us to easily initialize multiple chainstates on startup in future commits. It retires the g_chainstate global in lieu of g_chainman. --- src/test/util/setup_common.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/test/util/setup_common.cpp') diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index e19a96eafc..dacdce0acb 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -111,7 +111,7 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha GetMainSignals().RegisterBackgroundSignalScheduler(*g_rpc_node->scheduler); pblocktree.reset(new CBlockTreeDB(1 << 20, true)); - g_chainstate = MakeUnique(); + g_chainman.InitializeChainstate(); ::ChainstateActive().InitCoinsDB( /* cache_size_bytes */ 1 << 23, /* in_memory */ true, /* should_wipe */ false); assert(!::ChainstateActive().CanFlushToDisk()); @@ -153,7 +153,7 @@ TestingSetup::~TestingSetup() m_node.mempool = nullptr; m_node.scheduler.reset(); UnloadBlockIndex(); - g_chainstate.reset(); + g_chainman.Reset(); pblocktree.reset(); } -- cgit v1.2.3 From 2b081c4568e8019886fdb0f2a57babc73d7487f7 Mon Sep 17 00:00:00 2001 From: James O'Beirne Date: Thu, 12 Dec 2019 14:11:03 -0500 Subject: test: add basic tests for ChainstateManager Feedback incorporated from Russell Yanofsky. Co-authored-by: MarcoFalke --- src/test/util/setup_common.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/test/util/setup_common.cpp') diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index dacdce0acb..c77f59e050 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -111,6 +111,7 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha GetMainSignals().RegisterBackgroundSignalScheduler(*g_rpc_node->scheduler); pblocktree.reset(new CBlockTreeDB(1 << 20, true)); + g_chainman.InitializeChainstate(); ::ChainstateActive().InitCoinsDB( /* cache_size_bytes */ 1 << 23, /* in_memory */ true, /* should_wipe */ false); -- cgit v1.2.3