![]() |
Bitcoin Core 30.99.0
P2P Digital Currency
|
#include <validation.h>
Public Member Functions | |
| void | DisableNextWrite () |
| Disable the next write of all chainstates. More... | |
| void | ResetIbd () |
| Reset the ibd cache to its initial state. More... | |
| void | JumpOutOfIbd () |
| Toggle IsInitialBlockDownload from true to false. More... | |
| void | InvalidBlockFound (CBlockIndex *pindex, const BlockValidationState &state) EXCLUSIVE_LOCKS_REQUIRED(cs_main) |
| Wrappers that avoid making chainstatemanager internals public for tests. More... | |
| void | InvalidChainFound (CBlockIndex *pindexNew) EXCLUSIVE_LOCKS_REQUIRED(cs_main) |
| CBlockIndex * | FindMostWorkChain () EXCLUSIVE_LOCKS_REQUIRED(cs_main) |
| void | ResetBestInvalid () EXCLUSIVE_LOCKS_REQUIRED(cs_main) |
Public Member Functions inherited from ChainstateManager | |
| ChainstateManager (const util::SignalInterrupt &interrupt, Options options, node::BlockManager::Options blockman_options) | |
| const CChainParams & | GetParams () const |
| const Consensus::Params & | GetConsensus () const |
| bool | ShouldCheckBlockIndex () const |
| const arith_uint256 & | MinimumChainWork () const |
| const uint256 & | AssumedValidBlock () const |
| kernel::Notifications & | GetNotifications () const |
| void | CheckBlockIndex () const |
| Make various assertions about the state of the block index. More... | |
| RecursiveMutex & | GetMutex () 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 for which the block is not known to be invalid (used, among others, for getheaders queries' starting points). More... | |
| Chainstate * | HistoricalChainstate () const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) |
| Return historical chainstate targeting a specific block, if any. More... | |
| Chainstate & | ValidatedChainstate () const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) |
| Return fully validated chainstate that should be used for indexing, to support indexes that need to index blocks in order and can't start from the snapshot block. More... | |
| std::unique_ptr< Chainstate > | RemoveChainstate (Chainstate &chainstate) EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) |
| Remove a chainstate. More... | |
| node::BlockMap & | BlockIndex () EXCLUSIVE_LOCKS_REQUIRED( |
| bool | IsInitialBlockDownload () const |
| Check whether we are doing an initial block download (synchronizing from disk or network) More... | |
| double | GuessVerificationProgress (const CBlockIndex *pindex) const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) |
| 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 () | |
| std::vector< std::unique_ptr< Chainstate > > m_chainstates | GUARDED_BY (::cs_main) |
| List of chainstates. More... | |
| Chainstate & | ActiveChainstate () const |
| Alternatives to CurrentChainstate() used by older code to query latest chainstate information without locking cs_main. More... | |
| CChain & | ActiveChain () const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) |
| int | ActiveHeight () const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) |
| CBlockIndex * | ActiveTip () const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) |
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::SignalInterrupt & | m_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... | |
| size_t | m_total_coinstip_cache {0} |
| The total number of bytes available for us to use across all in-memory coins caches. More... | |
| size_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(util::Result< CBlockIndex * | ActivateSnapshot )(AutoFile &coins_file, const node::SnapshotMetadata &metadata, bool in_memory) |
| Instantiate a new chainstate. More... | |
| SnapshotCompletionResult MaybeValidateSnapshot(Chainstate &validated_cs, Chainstate &unvalidated_cs) EXCLUSIVE_LOCKS_REQUIRED(Chainstate & | CurrentChainstate () const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) |
| Try to validate an assumeutxo snapshot by using a validated historical chainstate targeted at the snapshot block. More... | |
| VersionBitsCache | m_versionbitscache |
| Track versionbit status. More... | |
| Chainstate *LoadAssumeutxoChainstate() EXCLUSIVE_LOCKS_REQUIRED(Chainstate &AddChainstate(std::unique_ptr< Chainstate > chainstate) EXCLUSIVE_LOCKS_REQUIRED(void ResetChainstates() EXCLUSIVE_LOCKS_REQUIRED(bool DeleteChainstate(Chainstate &chainstate) EXCLUSIVE_LOCKS_REQUIRED(bool ValidatedSnapshotCleanup(Chainstate &validated_cs, Chainstate &unvalidated_cs) EXCLUSIVE_LOCKS_REQUIRED(std::optional< std::pair< const CBlockIndex *, const CBlockIndex * > > GetHistoricalBlockRange() const EXCLUSIVE_LOCKS_REQUIRED(util::Result< void > ActivateBestChains() LOCKS_EXCLUDED(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 and load it if found. More... | |
Protected Member Functions inherited from ChainstateManager | |
| CBlockIndex *m_best_invalid | GUARDED_BY (::cs_main) |
Definition at line 20 of file validation.h.
| void TestChainstateManager::DisableNextWrite | ( | ) |
Disable the next write of all chainstates.
Definition at line 22 of file validation.cpp.
| CBlockIndex * TestChainstateManager::FindMostWorkChain | ( | ) |
Definition at line 78 of file validation.cpp.
| void TestChainstateManager::InvalidBlockFound | ( | CBlockIndex * | pindex, |
| const BlockValidationState & | state | ||
| ) |
Wrappers that avoid making chainstatemanager internals public for tests.
Definition at line 54 of file validation.cpp.
| void TestChainstateManager::InvalidChainFound | ( | CBlockIndex * | pindexNew | ) |
Definition at line 66 of file validation.cpp.
| void TestChainstateManager::JumpOutOfIbd | ( | ) |
Toggle IsInitialBlockDownload from true to false.
Definition at line 39 of file validation.cpp.
| void TestChainstateManager::ResetBestInvalid | ( | ) |
Definition at line 90 of file validation.cpp.
| void TestChainstateManager::ResetIbd | ( | ) |
Reset the ibd cache to its initial state.
Definition at line 33 of file validation.cpp.