Bitcoin Core 29.99.0
P2P Digital Currency
validation.cpp
Go to the documentation of this file.
1// Copyright (c) 2020-2022 The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
6
7#include <util/check.h>
8#include <util/time.h>
9#include <validation.h>
10#include <validationinterface.h>
11
13{
14 struct TestChainstate : public Chainstate {
15 void ResetNextWrite() { m_next_write = NodeClock::time_point::max() - 1s; }
16 };
17 for (auto* cs : GetAll()) {
18 static_cast<TestChainstate*>(cs)->ResetNextWrite();
19 }
20}
22{
25}
26
28{
32}
33
35 ChainstateRole role,
37 const std::shared_ptr<const CBlock>& block,
38 const CBlockIndex* pindex)
39{
40 obj.BlockConnected(role, block, pindex);
41}
#define Assert(val)
Identity function.
Definition: check.h:106
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: chain.h:141
Implement this to subscribe to events generated in validation and mempool.
virtual void BlockConnected(ChainstateRole role, const std::shared_ptr< const CBlock > &block, const CBlockIndex *pindex)
Notifies listeners of a block being connected.
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Definition: validation.h:531
bool IsInitialBlockDownload() const
Check whether we are doing an initial block download (synchronizing from disk or network)
std::atomic< bool > m_cached_finished_ibd
Whether initial block download has ended and IsInitialBlockDownload should return false from now on.
Definition: validation.h:1048
Chainstate &InitializeChainstate(CTxMemPool *mempool) EXCLUSIVE_LOCKS_REQUIRED(std::vector< Chainstate * GetAll)()
Instantiate a new chainstate.
Definition: validation.h:1092
static void BlockConnected(ChainstateRole role, CValidationInterface &obj, const std::shared_ptr< const CBlock > &block, const CBlockIndex *pindex)
Definition: validation.cpp:34
ChainstateRole
This enum describes the various roles a specific Chainstate instance can take.
Definition: chain.h:25
void DisableNextWrite()
Disable the next write of all chainstates.
Definition: validation.cpp:12
void JumpOutOfIbd()
Toggle IsInitialBlockDownload from true to false.
Definition: validation.cpp:27
void ResetIbd()
Reset the ibd cache to its initial state.
Definition: validation.cpp:21
static bool pool cs
Definition: validation.cpp:404
assert(!tx.IsCoinBase())