![]() |
Bitcoin Core 31.0.0
P2P Digital Currency
|
#include <validation.h>
Public Member Functions | |
| void | DisableNextWrite () |
| Disable the next write of all chainstates. | |
| void | ResetIbd () |
| Reset the ibd cache to its initial state. | |
| void | JumpOutOfIbd () |
| Toggle IsInitialBlockDownload from true to false. | |
| void | InvalidBlockFound (CBlockIndex *pindex, const BlockValidationState &state) EXCLUSIVE_LOCKS_REQUIRED(cs_main) |
| Wrappers that avoid making chainstatemanager internals public for tests. | |
| 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. | |
| RecursiveMutex & | GetMutex () const LOCK_RETURNED( |
| Alias for cs_main. | |
| 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. | |
| 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). | |
| Chainstate * | HistoricalChainstate () const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) |
| Return historical chainstate targeting a specific block, if any. | |
| Chainstate & | ValidatedChainstate () const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) |
| std::unique_ptr< Chainstate > | RemoveChainstate (Chainstate &chainstate) EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) |
| Remove a chainstate. | |
| void | UpdateIBDStatus () EXCLUSIVE_LOCKS_REQUIRED(cs_main) |
| Update and possibly latch the IBD status. | |
| node::BlockMap & | BlockIndex () EXCLUSIVE_LOCKS_REQUIRED( |
| bool | IsInitialBlockDownload () const noexcept |
| Check whether we are doing an initial block download (synchronizing from disk or network). | |
| 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). | |
| void | LoadExternalBlockFile (AutoFile &file_in, FlatFilePos *dbp=nullptr, std::multimap< uint256, FlatFilePos > *blocks_with_unknown_parent=nullptr) |
| Import blocks from an external file. | |
| 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. | |
| 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. | |
| 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). | |
| 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). | |
| MempoolAcceptResult | ProcessTransaction (const CTransactionRef &tx, bool test_accept=false) EXCLUSIVE_LOCKS_REQUIRED(cs_main) |
| Try to add a transaction to the memory pool. | |
| bool | LoadBlockIndex () EXCLUSIVE_LOCKS_REQUIRED(cs_main) |
| Load the block tree and coins database from disk, initializing state if we're running with -reindex. | |
| void MaybeRebalanceCaches() EXCLUSIVE_LOCKS_REQUIRED(void | UpdateUncommittedBlockStructures (CBlock &block, const CBlockIndex *pindexPrev) const |
| Update uncommitted block structures (currently: only the witness reserved value). | |
| void | GenerateCoinbaseCommitment (CBlock &block, const CBlockIndex *pindexPrev) const |
| Produce the necessary coinbase commitment for a block (modifies the hash, don't call for mined blocks). | |
| void | ReportHeadersPresync (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. | |
| ~ChainstateManager () | |
| std::vector< std::unique_ptr< Chainstate > > m_chainstates | GUARDED_BY (::cs_main) |
| Chainstate & | ActiveChainstate () const |
| 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()>() |
| const util::SignalInterrupt & | m_interrupt |
| const Options | m_options |
| node::BlockManager | m_blockman |
| ValidationCache | m_validation_cache |
| std::atomic_bool | m_cached_is_ibd {true} |
| Whether initial block download (IBD) is ongoing. | |
| int32_t | nBlockReverseSequenceId = -1 |
| Decreasing counter (used by subsequent preciousblock calls). | |
| arith_uint256 | nLastPreciousChainwork = 0 |
| chainwork for the last block that preciousblock has been applied to. | |
| size_t | m_total_coinstip_cache {0} |
| size_t | m_total_coinsdb_cache {0} |
| Chainstate &InitializeChainstate(CTxMemPool *mempool) EXCLUSIVE_LOCKS_REQUIRED(util::Result< CBlockIndex * | ActivateSnapshot )(AutoFile &coins_file, const node::SnapshotMetadata &metadata, bool in_memory) |
| SnapshotCompletionResult MaybeValidateSnapshot(Chainstate &validated_cs, Chainstate &unvalidated_cs) EXCLUSIVE_LOCKS_REQUIRED(Chainstate | CurrentChainstate )() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex()) |
| Return current chainstate targeting the most-work, network tip. | |
| VersionBitsCache | m_versionbitscache |
| Track versionbit status. | |
| 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(std::optional< int > BlocksAheadOfTip() const LOCKS_EXCLUDED(CCheckQueue< CScriptCheck > | GetCheckQueue )() |
| Add new chainstate. | |
| 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.