Changeset View
Changeset View
Standalone View
Standalone View
src/test/validation_chainstatemanager_tests.cpp
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(chainstatemanager) { | ||||
c2.InitCoinsDB( | c2.InitCoinsDB( | ||||
/* cache_size_bytes */ 1 << 23, /* in_memory */ true, | /* cache_size_bytes */ 1 << 23, /* in_memory */ true, | ||||
/* should_wipe */ false); | /* should_wipe */ false); | ||||
WITH_LOCK(::cs_main, c2.InitCoinsCache(1 << 23)); | WITH_LOCK(::cs_main, c2.InitCoinsCache(1 << 23)); | ||||
// Unlike c1, which doesn't have any blocks. Gets us different tip, height. | // Unlike c1, which doesn't have any blocks. Gets us different tip, height. | ||||
c2.LoadGenesisBlock(); | c2.LoadGenesisBlock(); | ||||
BlockValidationState _; | BlockValidationState _; | ||||
BOOST_CHECK(c2.ActivateBestChain(GetConfig(), _, nullptr)); | BOOST_CHECK(c2.ActivateBestChain(_, nullptr)); | ||||
BOOST_CHECK(manager.IsSnapshotActive()); | BOOST_CHECK(manager.IsSnapshotActive()); | ||||
BOOST_CHECK(WITH_LOCK(::cs_main, return !manager.IsSnapshotValidated())); | BOOST_CHECK(WITH_LOCK(::cs_main, return !manager.IsSnapshotValidated())); | ||||
BOOST_CHECK_EQUAL(&c2, &manager.ActiveChainstate()); | BOOST_CHECK_EQUAL(&c2, &manager.ActiveChainstate()); | ||||
BOOST_CHECK(&c1 != &manager.ActiveChainstate()); | BOOST_CHECK(&c1 != &manager.ActiveChainstate()); | ||||
auto all2 = manager.GetAll(); | auto all2 = manager.GetAll(); | ||||
BOOST_CHECK_EQUAL_COLLECTIONS(all2.begin(), all2.end(), chainstates.begin(), | BOOST_CHECK_EQUAL_COLLECTIONS(all2.begin(), all2.end(), chainstates.begin(), | ||||
chainstates.end()); | chainstates.end()); | ||||
▲ Show 20 Lines • Show All 642 Lines • Show Last 20 Lines |