9#include <boost/test/unit_test.hpp>
17BOOST_AUTO_TEST_SUITE(chainstate_write_tests)
22 bool m_did_flush{
false};
29 const auto sub{std::make_shared<TestSubscriber>()};
30 m_node.validation_signals->RegisterSharedValidationInterface(sub);
31 auto& chainstate{
Assert(m_node.chainman)->ActiveChainstate()};
36 m_node.validation_signals->SyncWithValidationInterfaceQueue();
42 m_node.validation_signals->SyncWithValidationInterfaceQueue();
47 m_node.validation_signals->SyncWithValidationInterfaceQueue();
62 m_flushed_at_block = m_tip;
69 auto& chainstate{
Assert(m_node.chainman)->ActiveChainstate()};
77 LOCK2(m_node.chainman->GetMutex(), chainstate.MempoolMutex());
78 chainstate.DisconnectTip(state_dummy,
nullptr);
79 chainstate.DisconnectTip(state_dummy,
nullptr);
86 m_node.validation_signals->SyncWithValidationInterfaceQueue();
91 const auto sub{std::make_shared<TestSubscriber>()};
92 m_node.validation_signals->RegisterSharedValidationInterface(sub);
95 chainstate.ActivateBestChain(state_dummy,
nullptr);
100 m_node.validation_signals->SyncWithValidationInterfaceQueue();
BOOST_FIXTURE_TEST_CASE(util_CheckValue, CheckValueTest)
BOOST_FIXTURE_TEST_CASE(chainstate_write_interval, TestingSetup)
static constexpr auto DATABASE_WRITE_INTERVAL_MAX
static constexpr auto DATABASE_WRITE_INTERVAL_MIN
#define Assert(val)
Identity function.
The block chain is a tree shaped structure starting with the genesis block at the root,...
CBlockIndex * pprev
pointer to the index of the predecessor of this block
Implement this to subscribe to events generated in validation and mempool.
virtual void ChainStateFlushed(const kernel::ChainstateRole &role, const CBlockLocator &locator)
Notifies listeners of the new active block chain on-disk.
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
Testing fixture that pre-creates a 100-block REGTEST-mode block chain.
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override
Notifies listeners when the block chain tip advances.
Testing setup that configures a complete environment.
Information about chainstate that notifications are sent from.
std::chrono::seconds GetMockTime()
For testing.
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.