25 void ResetNextWrite() { m_next_write = NodeClock::time_point::max() - 1
s; }
28 for (
const auto&
cs : m_chainstates) {
29 static_cast<TestChainstate&
>(*cs).ResetNextWrite();
49 const std::shared_ptr<const CBlock>& block,
63 static_cast<TestChainstate*
>(&
ActiveChainstate())->CallInvalidBlockFound(pindex, state);
75 static_cast<TestChainstate*
>(&
ActiveChainstate())->CallInvalidChainFound(pindexNew);
87 return static_cast<TestChainstate*
>(&
ActiveChainstate())->CallFindMostWorkChain();
92 m_best_invalid =
nullptr;
std::set< int > m_dirty_fileinfo
Dirty block file entries.
Information about chainstate that notifications are sent from.
void InvalidBlockFound(CBlockIndex *pindex, const BlockValidationState &state) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Wrappers that avoid making chainstatemanager internals public for tests.
static void BlockConnected(const kernel::ChainstateRole &role, CValidationInterface &obj, const std::shared_ptr< const CBlock > &block, const CBlockIndex *pindex)
bool IsInitialBlockDownload() const noexcept
Check whether we are doing an initial block download (synchronizing from disk or network) ...
Implement this to subscribe to events generated in validation and mempool.
void JumpOutOfIbd()
Toggle IsInitialBlockDownload from true to false.
Chainstate stores and provides an API to update our local knowledge of the current best chain...
CBlockIndex * FindMostWorkChain() EXCLUSIVE_LOCKS_REQUIRED(cs_main)
virtual void BlockConnected(const kernel::ChainstateRole &role, const std::shared_ptr< const CBlock > &block, const CBlockIndex *pindex)
Notifies listeners of a block being connected.
#define EXCLUSIVE_LOCKS_REQUIRED(...)
void InvalidChainFound(CBlockIndex *pindexNew) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
std::set< CBlockIndex * > m_dirty_blockindex
Dirty block index entries.
The block chain is a tree shaped structure starting with the genesis block at the root...
void ResetIbd()
Reset the ibd cache to its initial state.
Chainstate & ActiveChainstate() const
Alternatives to CurrentChainstate() used by older code to query latest chainstate information without...
void DisableNextWrite()
Disable the next write of all chainstates.
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate...
void ResetBestInvalid() EXCLUSIVE_LOCKS_REQUIRED(cs_main)
void CleanupForFuzzing()
Test-only method to clear internal state for fuzzing.
#define Assert(val)
Identity function.
std::atomic_bool m_cached_is_ibd
Whether initial block download (IBD) is ongoing.
std::vector< CBlockFileInfo > m_blockfile_info