Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | List of all members
TestChainstateManager Struct Reference

#include <validation.h>

Inheritance diagram for TestChainstateManager:
[legend]
Collaboration diagram for TestChainstateManager:
[legend]

Public Member Functions

void ResetIbd ()
 Reset the ibd cache to its initial state. More...
 
void JumpOutOfIbd ()
 Toggle IsInitialBlockDownload from true to false. More...
 
- Public Member Functions inherited from ChainstateManager
 ChainstateManager (const util::SignalInterrupt &interrupt, Options options, node::BlockManager::Options blockman_options)
 
const CChainParamsGetParams () const
 
const Consensus::ParamsGetConsensus () const
 
bool ShouldCheckBlockIndex () const
 
const arith_uint256MinimumChainWork () const
 
const uint256AssumedValidBlock () const
 
kernel::NotificationsGetNotifications () const
 
void CheckBlockIndex ()
 Make various assertions about the state of the block index. More...
 
RecursiveMutexGetMutex () const LOCK_RETURNED(
 Alias for cs_main. More...
 
int32_t nBlockSequenceId GUARDED_BY (::cs_main)
 Every received block is assigned a unique and increasing identifier, so we know which one to give priority in case of a fork. More...
 
void ResetBlockSequenceCounters () EXCLUSIVE_LOCKS_REQUIRED(
 
CBlockIndex *m_best_header GUARDED_BY (::cs_main)
 Best header we've seen so far (used for getheaders queries' starting points). More...
 
util::Result< CBlockIndex * > ActivateSnapshot (AutoFile &coins_file, const node::SnapshotMetadata &metadata, bool in_memory)
 Construct and activate a Chainstate on the basis of UTXO snapshot data. More...
 
CChainActiveChain () const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
 
int ActiveHeight () const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
 
CBlockIndexActiveTip () const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
 
bool BackgroundSyncInProgress () const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
 The state of a background sync (for net processing) More...
 
const CBlockIndexGetBackgroundSyncTip () const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
 The tip of the background sync chain. More...
 
node::BlockMapBlockIndex () EXCLUSIVE_LOCKS_REQUIRED(
 
bool IsSnapshotActive () const
 
std::optional< uint256SnapshotBlockhash () const
 
bool IsSnapshotValidated () const EXCLUSIVE_LOCKS_REQUIRED(
 Is there a snapshot in use and has it been fully validated? More...
 
bool IsInitialBlockDownload () const
 Check whether we are doing an initial block download (synchronizing from disk or network) More...
 
double GuessVerificationProgress (const CBlockIndex *pindex) const
 Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). More...
 
void LoadExternalBlockFile (AutoFile &file_in, FlatFilePos *dbp=nullptr, std::multimap< uint256, FlatFilePos > *blocks_with_unknown_parent=nullptr)
 Import blocks from an external file. More...
 
bool ProcessNewBlock (const std::shared_ptr< const CBlock > &block, bool force_processing, bool min_pow_checked, bool *new_block) LOCKS_EXCLUDED(cs_main)
 Process an incoming block. More...
 
bool ProcessNewBlockHeaders (std::span< const CBlockHeader > headers, bool min_pow_checked, BlockValidationState &state, const CBlockIndex **ppindex=nullptr) LOCKS_EXCLUDED(cs_main)
 Process incoming block headers. More...
 
bool AcceptBlock (const std::shared_ptr< const CBlock > &pblock, BlockValidationState &state, CBlockIndex **ppindex, bool fRequested, const FlatFilePos *dbp, bool *fNewBlock, bool min_pow_checked) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 Sufficiently validate a block for disk storage (and store on disk). More...
 
void ReceivedBlockTransactions (const CBlock &block, CBlockIndex *pindexNew, const FlatFilePos &pos) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 Mark a block as having its data received and checked (up to BLOCK_VALID_TRANSACTIONS). More...
 
MempoolAcceptResult ProcessTransaction (const CTransactionRef &tx, bool test_accept=false) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 Try to add a transaction to the memory pool. More...
 
bool LoadBlockIndex () EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 Load the block tree and coins database from disk, initializing state if we're running with -reindex. More...
 
void MaybeRebalanceCaches() EXCLUSIVE_LOCKS_REQUIRED(void UpdateUncommittedBlockStructures (CBlock &block, const CBlockIndex *pindexPrev) const
 Check to see if caches are out of balance and if so, call ResizeCoinsCaches() as needed. More...
 
std::vector< unsigned char > GenerateCoinbaseCommitment (CBlock &block, const CBlockIndex *pindexPrev) const
 Produce the necessary coinbase commitment for a block (modifies the hash, don't call for mined blocks). More...
 
void ReportHeadersPresync (const arith_uint256 &work, int64_t height, int64_t timestamp)
 This is used by net_processing to report pre-synchronization progress of headers, as headers are not yet fed to validation during that time, but validation is (for now) responsible for logging and signalling through NotifyHeaderTip, so it needs this information. More...
 
 ~ChainstateManager ()
 

Additional Inherited Members

- Public Types inherited from ChainstateManager
using Options = kernel::ChainstateManagerOpts
 
- Public Attributes inherited from ChainstateManager
std::function< void()> snapshot_download_completed = std::function<void()>()
 Function to restart active indexes; set dynamically to avoid a circular dependency on base/index.cpp. More...
 
const util::SignalInterruptm_interrupt
 
const Options m_options
 
node::BlockManager m_blockman
 A single BlockManager instance is shared across each constructed chainstate to avoid duplicating block metadata. More...
 
ValidationCache m_validation_cache
 
std::atomic< bool > m_cached_finished_ibd {false}
 Whether initial block download has ended and IsInitialBlockDownload should return false from now on. More...
 
int32_t nBlockReverseSequenceId = -1
 Decreasing counter (used by subsequent preciousblock calls). More...
 
arith_uint256 nLastPreciousChainwork = 0
 chainwork for the last block that preciousblock has been applied to. More...
 
std::set< CBlockIndex * > m_failed_blocks
 In order to efficiently track invalidity of headers, we keep the set of blocks which we tried to connect and found to be invalid here (ie which were set to BLOCK_FAILED_VALID since the last restart). More...
 
int64_t m_total_coinstip_cache {0}
 The total number of bytes available for us to use across all in-memory coins caches. More...
 
int64_t m_total_coinsdb_cache {0}
 The total number of bytes available for us to use across all leveldb coins databases. More...
 
Chainstate &InitializeChainstate(CTxMemPool *mempool) EXCLUSIVE_LOCKS_REQUIRED(std::vector< ChainstateGetAll )()
 Instantiate a new chainstate. More...
 
SnapshotCompletionResult MaybeCompleteSnapshotValidation() EXCLUSIVE_LOCKS_REQUIRED(const CBlockIndex *GetSnapshotBaseBlock() const EXCLUSIVE_LOCKS_REQUIRED(Chainstate ActiveChainstate )() const
 Once the background validation chainstate has reached the height which is the base of the UTXO snapshot in use, compare its coins to ensure they match those expected by the snapshot. More...
 
VersionBitsCache m_versionbitscache
 Track versionbit status. More...
 
bool DetectSnapshotChainstate() EXCLUSIVE_LOCKS_REQUIRED(void ResetChainstates() EXCLUSIVE_LOCKS_REQUIRED(bool DeleteSnapshotChainstate() EXCLUSIVE_LOCKS_REQUIRED(Chainstate &ActivateExistingSnapshot(uint256 base_blockhash) EXCLUSIVE_LOCKS_REQUIRED(bool ValidatedSnapshotCleanup() EXCLUSIVE_LOCKS_REQUIRED(Chainstate &GetChainstateForIndexing() EXCLUSIVE_LOCKS_REQUIRED(std::pair< int, int > GetPruneRange(const Chainstate &chainstate, int last_height_can_prune) EXCLUSIVE_LOCKS_REQUIRED(std::optional< int > GetSnapshotBaseHeight() const EXCLUSIVE_LOCKS_REQUIRED(void RecalculateBestHeader() EXCLUSIVE_LOCKS_REQUIRED(CCheckQueue< CScriptCheck > & GetCheckQueue ()
 When starting up, search the datadir for a chainstate based on a UTXO snapshot that is in the process of being validated. More...
 

Detailed Description

Definition at line 12 of file validation.h.

Member Function Documentation

◆ JumpOutOfIbd()

void TestChainstateManager::JumpOutOfIbd ( )

Toggle IsInitialBlockDownload from true to false.

Definition at line 18 of file validation.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResetIbd()

void TestChainstateManager::ResetIbd ( )

Reset the ibd cache to its initial state.

Definition at line 12 of file validation.cpp.

Here is the call graph for this function:

The documentation for this struct was generated from the following files: