6 #ifndef BITCOIN_VALIDATION_H 7 #define BITCOIN_VALIDATION_H 37 #include <util/time.h> 50 #include <type_traits> 63 struct ChainstateRole;
66 class SnapshotMetadata;
72 class SignalInterrupt;
173 const std::vector<Wtxid>& wtxids_fee_calculations) {
181 const std::vector<Wtxid>& wtxids_fee_calculations) {
183 effective_feerate, wtxids_fee_calculations);
207 const std::vector<Wtxid>& wtxids_fee_calculations)
218 const std::vector<Wtxid>& wtxids_fee_calculations)
248 std::map<Wtxid, MempoolAcceptResult>&& results)
252 std::map<Wtxid, MempoolAcceptResult>&& results)
275 int64_t accept_time,
bool bypass_limits,
bool test_accept)
289 const Package& txns,
bool test_accept,
const std::optional<CFeeRate>& client_maxfeerate)
358 std::optional<std::pair<ScriptError, std::string>>
operator()();
362 static_assert(std::is_nothrow_move_assignable_v<CScriptCheck>);
363 static_assert(std::is_nothrow_move_constructible_v<CScriptCheck>);
364 static_assert(std::is_nothrow_destructible_v<CScriptCheck>);
380 ValidationCache(
size_t script_execution_cache_bytes,
size_t signature_cache_bytes);
461 inline constexpr std::array
FlushStateModeNames{
"NONE",
"IF_NEEDED",
"PERIODIC",
"FORCE_FLUSH",
"FORCE_SYNC"};
521 constexpr int64_t MAX_BLOCK_COINSDB_USAGE_BYTES{int64_t(10_MiB)};
522 return std::max((total_space * 9) / 10,
523 total_space - MAX_BLOCK_COINSDB_USAGE_BYTES);
589 std::optional<uint256> from_snapshot_blockhash = std::nullopt);
607 size_t cache_size_bytes,
673 return target_block && target_block ==
m_chain.
Tip();
725 bool ResizeCoinsCaches(
size_t coinstip_size,
size_t coinsdb_size)
739 bool FlushStateToDisk(
742 int nManualPruneHeight = 0);
772 bool ActivateBestChain(
774 std::shared_ptr<const CBlock> pblock =
nullptr)
837 size_t max_coins_cache_size_bytes,
858 std::shared_ptr<const CBlock> block_to_connect,
955 [[nodiscard]]
util::
Result<
void> PopulateAndValidateSnapshot(
958 const
node::SnapshotMetadata& metadata);
967 bool AcceptBlockHeader(
1005 std::function<void()> snapshot_download_completed = std::function<void()>();
1009 bool ShouldCheckBlockIndex()
const;
1049 std::atomic_bool m_cached_is_ibd{
true};
1060 int32_t nBlockReverseSequenceId = -1;
1070 nBlockReverseSequenceId = -1;
1082 size_t m_total_coinstip_cache{0};
1086 size_t m_total_coinsdb_cache{0};
1121 for (
auto&
cs : m_chainstates) {
1130 for (
auto&
cs : m_chainstates) {
1141 for (
auto*
cs : {&CurrentChainstate(), HistoricalChainstate()}) {
1150 auto it{std::find_if(m_chainstates.begin(), m_chainstates.end(), [&](
auto&
cs) {
return cs.get() == &chainstate; })};
1151 if (it != m_chainstates.end()) {
1152 auto ret{std::move(*it)};
1153 m_chainstates.erase(it);
1195 bool IsInitialBlockDownload() const noexcept;
1255 bool ProcessNewBlock(const
std::shared_ptr<const
CBlock>& block,
bool force_processing,
bool min_pow_checked,
bool* new_block)
LOCKS_EXCLUDED(
cs_main);
1315 void UpdateUncommittedBlockStructures(
CBlock& block, const
CBlockIndex* pindexPrev) const;
1318 void GenerateCoinbaseCommitment(
CBlock& block, const
CBlockIndex* pindexPrev) const;
1324 void ReportHeadersPresync(int64_t height, int64_t timestamp);
1381 template<
typename DEP>
1387 template<
typename DEP>
1393 template<
typename DEP>
1408 #endif // BITCOIN_VALIDATION_H std::shared_ptr< const CTransaction > CTransactionRef
CCoinsViewCache & CoinsTip() EXCLUSIVE_LOCKS_REQUIRED(
const std::optional< CFeeRate > m_effective_feerate
The feerate at which this transaction was considered.
Mockable clock in the context of tests, otherwise the system clock.
bool ConnectTip(BlockValidationState &state, CBlockIndex *pindexNew, std::shared_ptr< const CBlock > block_to_connect, ConnectTrace &connectTrace, DisconnectedBlockTransactions &disconnectpool) EXCLUSIVE_LOCKS_REQUIRED(cs_main
Connect a new block to m_chain.
const CBlockIndex *m_cached_target_block GUARDED_BY(::cs_main)
Cached result of LookupBlockIndex(*m_target_blockhash)
node::BlockManager m_blockman
A single BlockManager instance is shared across each constructed chainstate to avoid duplicating bloc...
const std::optional< uint256 > m_from_snapshot_blockhash
The blockhash which is the base of the snapshot this chainstate was created from. ...
const uint256 & AssumedValidBlock() const
void InvalidChainFound(CBlockIndex *pindexNew) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
CTxMemPool * m_mempool
Optional mempool that is kept in sync with the chain.
script_verify_flags m_flags
Valid signature cache, to avoid doing expensive ECDSA signature checking twice for every transaction ...
bool ReplayBlocks()
Replay blocks that aren't fully applied to the database.
The assumeutxo snapshot failed validation.
CScriptCheck & operator=(const CScriptCheck &)=delete
bool DeploymentActiveAfter(const CBlockIndex *pindexPrev, const ChainstateManager &chainman, DEP dep)
Deployment* info via ChainstateManager.
SignatureCache m_signature_cache
bool DeploymentActiveAt(const CBlockIndex &index, const ChainstateManager &chainman, DEP dep)
static MempoolAcceptResult FeeFailure(TxValidationState state, CFeeRate effective_feerate, const std::vector< Wtxid > &wtxids_fee_calculations)
SynchronizationState
Current sync state passed to tip changed callbacks.
std::set< CBlockIndex *, node::CBlockIndexWorkComparator > setBlockIndexCandidates
The set of all CBlockIndex entries that have as much work as our current tip or more, and transaction data needed to be validated (with BLOCK_VALID_TRANSACTIONS for each block and its parents back to the genesis block or an assumeutxo snapshot block).
Convenience class for initializing and passing the script execution cache and signature cache...
bool LoadGenesisBlock()
Ensures we have a genesis block in the block tree, possibly writing one to disk.
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
int64_t GUARDED_BY(::cs_main) num_blocks_total
const std::optional< std::vector< Wtxid > > m_wtxids_fee_calculations
Contains the wtxids of the transactions used for fee-related checks.
CBlockIndex *m_best_invalid GUARDED_BY(::cs_main)
Valid, transaction was already in the mempool.
node::BlockManager & m_blockman
Reference to a BlockManager instance which itself is shared across all Chainstate instances...
The cache is at >= 90% capacity.
A convenience class for constructing the CCoinsView* hierarchy used to facilitate access to the UTXO ...
Interface for managing multiple Chainstate objects, where each chainstate is associated with chainsta...
An in-memory indexed chain of blocks.
BlockValidationState TestBlockValidity(Chainstate &chainstate, const CBlock &block, bool check_pow, bool check_merkle_root) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Verify a block, including transactions.
SteadyClock::duration GUARDED_BY(::cs_main) time_connect
size_t m_coinsdb_cache_size_bytes
The cache size of the on-disk coins view.
VerifyDBResult VerifyDB(Chainstate &chainstate, const Consensus::Params &consensus_params, CCoinsView &coinsview, int nCheckLevel, int nCheckDepth) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
std::vector< CTransactionRef > Package
A package is an ordered list of transactions.
static const unsigned int MIN_BLOCKS_TO_KEEP
Block files containing a block-height within MIN_BLOCKS_TO_KEEP of ActiveChain().Tip() will not be pr...
Information about chainstate that notifications are sent from.
std::unique_ptr< CoinsViews > m_coins_views
Manages the UTXO set, which is a reflection of the contents of m_chain.
CChain & ActiveChain() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
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.
CSHA256 m_script_execution_cache_hasher
Pre-initialized hasher to avoid having to recreate it for every hash calculation. ...
static constexpr int DEFAULT_CHECKLEVEL
ResultType
Used to indicate the results of mempool validation.
int Height() const
Return the maximal height in the chain.
std::unordered_map< uint256, CBlockIndex, BlockHasher > BlockMap
bool CheckFinalTxAtTip(const CBlockIndex &active_chain_tip, const CTransaction &tx)
static constexpr int MAX_SCRIPTCHECK_THREADS
Maximum number of dedicated script-checking threads allowed.
The coins cache is in immediate need of a flush.
An options struct for ChainstateManager, more ergonomically referred to as ChainstateManager::Options...
const std::optional< int64_t > m_vsize
Virtual size as used by the mempool, calculated using serialized size and sigops. ...
const TxValidationState m_state
Contains information about why the transaction failed.
const std::optional< CAmount > m_base_fees
Raw base fees in satoshis.
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system...
User-controlled performance and debug options.
void MaybeUpdateMempoolForReorg(DisconnectedBlockTransactions &disconnectpool, bool fAddToMempool) EXCLUSIVE_LOCKS_REQUIRED(cs_main
Make mempool consistent after a reorg, by re-adding or recursively erasing disconnected block transac...
const ResultType m_result_type
Result type.
void InvalidBlockFound(CBlockIndex *pindex, const BlockValidationState &state) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
PackageMempoolAcceptResult(PackageValidationState state, CFeeRate feerate, std::map< Wtxid, MempoolAcceptResult > &&results)
std::map< Wtxid, MempoolAcceptResult > m_tx_results
Map from wtxid to finished MempoolAcceptResults.
bool DeploymentEnabled(const ChainstateManager &chainman, DEP dep)
bool IsBIP30Unspendable(const uint256 &block_hash, int block_height)
Identifies blocks which coinbase output was subsequently overwritten in the UTXO set (see BIP30) ...
const std::vector< std::string > CHECKLEVEL_DOC
Documentation for argument 'checklevel'.
CChain m_chain
The current chain of blockheaders we consult and build on.
Non-refcounted RAII wrapper for FILE*.
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).
void ForceFlushStateToDisk(bool wipe_cache=true)
Flush all changes to disk.
void ResetCoinsViews()
Destructs all objects related to accessing the UTXO set.
PackageMempoolAcceptResult(PackageValidationState state, std::map< Wtxid, MempoolAcceptResult > &&results)
const util::SignalInterrupt & m_interrupt
CVerifyDB(kernel::Notifications ¬ifications)
Transaction validation functions.
VersionBitsCache m_versionbitscache
Track versionbit status.
CoinsViews(DBParams db_params, CoinsViewOptions options)
This constructor initializes CCoinsViewDB and CCoinsViewErrorCatcher instances, but it does not creat...
void PruneBlockFilesManual(Chainstate &active_chainstate, int nManualPruneHeight)
Prune block files up to a given height.
int64_t CAmount
Amount in satoshis (Can be negative)
void PruneAndFlush()
Prune blockfiles from the disk if necessary and then flush chainstate changes if we pruned...
PackageMempoolAcceptResult ProcessNewPackage(Chainstate &active_chainstate, CTxMemPool &pool, const Package &txns, bool test_accept, const std::optional< CFeeRate > &client_maxfeerate) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Validate (and maybe submit) a package to the mempool.
CScriptCheck(const CTxOut &outIn, const CTransaction &txToIn, SignatureCache &signature_cache, unsigned int nInIn, script_verify_flags flags, bool cacheIn, PrecomputedTransactionData *txdataIn)
ChainstateManager & m_chainman
The chainstate manager that owns this chainstate.
bool DisconnectTip(BlockValidationState &state, DisconnectedBlockTransactions *disconnectpool) EXCLUSIVE_LOCKS_REQUIRED(cs_main
Disconnect m_chain's tip.
An options struct for BlockManager, more ergonomically referred to as BlockManager::Options due to th...
constexpr std::array FlushStateModeNames
util::Result< void > InvalidateCoinsDBOnDisk() EXCLUSIVE_LOCKS_REQUIRED(friend ChainstateManager
In case of an invalid snapshot, rename the coins leveldb directory so that it can be examined for iss...
Blocks after an assumeutxo snapshot have been validated but the snapshot itself has not been validate...
Chainstate stores and provides an API to update our local knowledge of the current best chain...
bool IsBIP30Repeat(const CBlockIndex &block_index)
Identifies blocks that overwrote an existing coinbase output in the UTXO set (see BIP30) ...
const std::list< CTransactionRef > m_replaced_transactions
Mempool transactions replaced by the tx.
constexpr int64_t LargeCoinsCacheThreshold(int64_t total_space) noexcept
Abstract view on the open txout dataset.
static void LoadExternalBlockFile(benchmark::Bench &bench)
The LoadExternalBlockFile() function is used during -reindex and -loadblock.
Chainstate & ValidatedChainstate() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
Return fully validated chainstate that should be used for indexing, to support indexes that need to i...
Validation result for package mempool acceptance.
std::unique_ptr< Chainstate > RemoveChainstate(Chainstate &chainstate) EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
Remove a chainstate.
bool ActivateBestChain(BlockValidationState &state, std::shared_ptr< const CBlock > pblock=nullptr) LOCKS_EXCLUDED(DisconnectResult DisconnectBlock(const CBlock &block, const CBlockIndex *pindex, CCoinsViewCache &view) EXCLUSIVE_LOCKS_REQUIRED(boo ConnectBlock)(const CBlock &block, BlockValidationState &state, CBlockIndex *pindex, CCoinsViewCache &view, bool fJustCheck=false) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Find the best known block, and make it the tip of the block chain.
bool RollforwardBlock(const CBlockIndex *pindex, CCoinsViewCache &inputs) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Apply the effects of a block on the utxo cache, ignoring that it may already have been applied...
ValidationCache(size_t script_execution_cache_bytes, size_t signature_cache_bytes)
Chainstate(CTxMemPool *mempool, node::BlockManager &blockman, ChainstateManager &chainman, std::optional< uint256 > from_snapshot_blockhash=std::nullopt)
kernel::Notifications & GetNotifications() const
CBlockIndex *m_last_notified_header GUARDED_BY(GetMutex())
The last header for which a headerTip notification was issued.
std::optional< std::pair< ScriptError, std::string > > operator()()
RAII wrapper for VerifyDB: Verify consistency of the block and coin databases.
bool NeedsRedownload() const EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Whether the chain state needs to be redownloaded due to lack of witness data.
Holds various statistics on transactions within a chain.
const Consensus::Params & GetConsensus() const
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 sna...
bool ActivateBestChainStep(BlockValidationState &state, CBlockIndex *pindexMostWork, const std::shared_ptr< const CBlock > &pblock, bool &fInvalidFound, ConnectTrace &connectTrace) EXCLUSIVE_LOCKS_REQUIRED(cs_main
Return the [start, end] (inclusive) of block heights we can prune.
SteadyClock::duration GUARDED_BY(::cs_main) time_index
bool FatalError(kernel::Notifications ¬ifications, BlockValidationState &state, const bilingual_str &message)
CBlockIndex * ActiveTip() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
Maintains a tree of blocks (stored in m_block_index) which is consulted to determine where the most-w...
CCoinsViewDB & CoinsDB() EXCLUSIVE_LOCKS_REQUIRED(
SteadyClock::duration GUARDED_BY(::cs_main) time_total
Every block in the chain has been validated.
CCoinsViewErrorCatcher & CoinsErrorCatcher() EXCLUSIVE_LOCKS_REQUIRED(
An output of a transaction.
bool LoadChainTip() EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Update the chain tip based on database information, i.e.
static void CheckBlockIndex(benchmark::Bench &bench)
RecursiveMutex & GetMutex() const LOCK_RETURNED(
Alias for cs_main.
CBlockIndex * FindMostWorkChain() EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Return the tip of the chain with the most work in it, that isn't known to be invalid (it's however fa...
Parameters that influence chain consensus.
A base class defining functions for notifying about certain kernel events.
void TryAddBlockIndexCandidate(CBlockIndex *pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Add a block to the candidate set if it has as much work as the current tip.
bool CheckFinalTxAtTip(const CBlockIndex &active_chain_tip, const CTransaction &tx) EXCLUSIVE_LOCKS_REQUIRED(std::optional< LockPoints > CalculateLockPointsAtTip(CBlockIndex *tip, const CCoinsView &coins_view, const CTransaction &tx)
Check if transaction will be final in the next block to be created.
MempoolAcceptResult AcceptToMemoryPool(Chainstate &active_chainstate, const CTransactionRef &tx, int64_t accept_time, bool bypass_limits, bool test_accept) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Try to add a transaction to the mempool.
DisconnectedBlockTransactions.
Validation result for a transaction evaluated by MemPoolAccept (single or package).
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params &consensusParams)
MempoolAcceptResult(TxValidationState state)
Constructor for failure case.
static MempoolAcceptResult MempoolTx(int64_t vsize, CAmount fees)
#define Assume(val)
Assume is the identity function.
static MempoolAcceptResult MempoolTxDifferentWitness(const Wtxid &other_wtxid)
256-bit unsigned big integer.
SteadyClock::duration GUARDED_BY(::cs_main) time_post_connect
BIP 9 allows multiple softforks to be deployed in parallel.
Closure representing one script verification Note that this stores references to the spending transac...
ValidationCache m_validation_cache
void InvalidateBlock(ChainstateManager &chainman, const uint256 block_hash)
MempoolAcceptResult(TxValidationState state, CFeeRate effective_feerate, const std::vector< Wtxid > &wtxids_fee_calculations)
Constructor for fee-related failure case.
SteadyClock::duration GUARDED_BY(::cs_main) time_verify
Helper class that manages an interrupt flag, and allows a thread or signal to interrupt another threa...
SteadyClock::duration GUARDED_BY(::cs_main) time_flush
ValidationCache & operator=(const ValidationCache &)=delete
const CChainParams & GetParams() const
PackageValidationState m_state
CSHA256 ScriptExecutionCacheHasher() const
Return a copy of the pre-initialized hasher.
const CTransaction * ptxTo
const arith_uint256 & MinimumChainWork() const
#define EXCLUSIVE_LOCKS_REQUIRED(...)
fs::path StoragePath() const
Return path to chainstate leveldb directory.
kernel::Notifications & m_notifications
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
bool HasValidProofOfWork(std::span< const CBlockHeader > headers, const Consensus::Params &consensusParams)
Check that the proof of work on each blockheader matches the value in nBits.
Assumeutxo
Chainstate assumeutxo validity.
#define LOCKS_EXCLUDED(...)
CCoinsViewDB m_dbview GUARDED_BY(cs_main)
The lowest level of the CoinsViews cache hierarchy sits in a leveldb database on disk.
The block chain is a tree shaped structure starting with the genesis block at the root...
const CChainParams & Params()
Return the currently selected parameters.
static const signed int DEFAULT_CHECKBLOCKS
CCoinsView backed by the coin database (chainstate/)
void PruneBlockIndexCandidates()
Delete all entries in setBlockIndexCandidates that are worse than the current tip.
static constexpr int32_t SEQ_ID_INIT_FROM_DISK
SteadyClock::duration GUARDED_BY(::cs_main) time_check
Timers and counters used for benchmarking validation in both background and active chainstates...
void ResetBlockSequenceCounters() EXCLUSIVE_LOCKS_REQUIRED(
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
int ActiveHeight() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
Application-specific storage settings.
Fee rate in satoshis per virtualbyte: CAmount / vB the feerate is represented internally as FeeFrac...
Holds configuration for use during UTXO snapshot load and validation.
const CBlockIndex *SnapshotBase() const EXCLUSIVE_LOCKS_REQUIRED(const CBlockIndex *TargetBlock() const EXCLUSIVE_LOCKS_REQUIRED(void SetTargetBlock(CBlockIndex *block) EXCLUSIVE_LOCKS_REQUIRED(void SetTargetBlockHash(uint256 block_hash) EXCLUSIVE_LOCKS_REQUIRED(boo ReachedTarget)() const EXCLUSIVE_LOCKS_REQUIRED(
The base of the snapshot this chainstate was created from.
PackageMempoolAcceptResult(const Wtxid &wtxid, const MempoolAcceptResult &result)
Constructor to create a PackageMempoolAcceptResult from a single MempoolAcceptResult.
script_verify_flags GetBlockScriptFlags(const CBlockIndex &block_index, const ChainstateManager &chainman)
size_t m_coinstip_cache_size_bytes
The cache size of the in-memory coins view.
bool CheckBlock(const CBlock &block, BlockValidationState &state, const Consensus::Params &consensusParams, bool fCheckPOW=true, bool fCheckMerkleRoot=true)
Functions for validating blocks and updating the block tree.
MempoolAcceptResult(std::list< CTransactionRef > &&replaced_txns, int64_t vsize, CAmount fees, CFeeRate effective_feerate, const std::vector< Wtxid > &wtxids_fee_calculations)
Constructor for success case.
Mutex m_chainstate_mutex
The ChainState Mutex A lock that must be held when modifying this ChainState - held in ActivateBestCh...
static MempoolAcceptResult Failure(TxValidationState state)
SteadyClock::duration GUARDED_BY(::cs_main) time_chainstate
The basic transaction that is broadcasted on the network and contained in blocks. ...
void CheckForkWarningConditions() EXCLUSIVE_LOCKS_REQUIRED(cs_main)
CCoinsView that adds a memory cache for transactions to another CCoinsView.
static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES
MempoolAcceptResult(int64_t vsize, CAmount fees)
Constructor for already-in-mempool case.
MempoolAcceptResult(const Wtxid &other_wtxid)
Constructor for witness-swapped case.
CuckooCache::cache< uint256, SignatureCacheHasher > m_script_execution_cache
A hasher class for SHA-256.
Version of SteadyClock that is mockable in the context of tests (set the current value with SetMockTi...
Chainstate * HistoricalChainstate() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
Return historical chainstate targeting a specific block, if any.
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
This is a minimally invasive approach to shutdown on LevelDB read errors from the chainstate...
bool PreciousBlock(BlockValidationState &state, CBlockIndex *pindex) LOCKS_EXCLUDED(bool InvalidateBlock(BlockValidationState &state, CBlockIndex *pindex) LOCKS_EXCLUDED(void SetBlockFailureFlags(CBlockIndex *pindex) EXCLUSIVE_LOCKS_REQUIRED(voi ResetBlockFailureFlags)(CBlockIndex *pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Mark a block as precious and reorganize.
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate...
arith_uint256 CalculateClaimedHeadersWork(std::span< const CBlockHeader > headers)
Return the sum of the claimed work on a given set of headers.
SignatureCache * m_signature_cache
bool CheckSequenceLocksAtTip(CBlockIndex *tip, const LockPoints &lock_points)
Check if transaction will be BIP68 final in the next block to be created on top of tip...
const CBlockIndex *m_cached_snapshot_base GUARDED_BY(::cs_main)
Cached result of LookupBlockIndex(*m_from_snapshot_blockhash)
CTxMemPool * GetMempool()
std::string ToString(const T &t)
Locale-independent version of std::to_string.
const std::optional< Wtxid > m_other_wtxid
The wtxid of the transaction in the mempool which has the same txid but different witness...
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it...
#define Assert(val)
Identity function.
void UpdateTip(const CBlockIndex *pindexNew) EXCLUSIVE_LOCKS_REQUIRED(NodeClock::time_poin m_next_write)
Check warning conditions and do some notifications on new chain tip set.
static MempoolAcceptResult Success(std::list< CTransactionRef > &&replaced_txns, int64_t vsize, CAmount fees, CFeeRate effective_feerate, const std::vector< Wtxid > &wtxids_fee_calculations)
SteadyClock::duration GUARDED_BY(::cs_main) time_undo
Used to track blocks whose transactions were applied to the UTXO state as a part of a single Activate...
transaction_identifier represents the two canonical transaction identifier types (txid, wtxid).
bool IsBlockMutated(const CBlock &block, bool check_witness_root)
Check if a block has been mutated (with respect to its merkle root and witness commitments).
SteadyClock::duration GUARDED_BY(::cs_main) time_connect_total
PrecomputedTransactionData * txdata
SteadyClock::duration GUARDED_BY(::cs_main) time_forks