Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
validation.cpp File Reference
#include <bitcoin-build-config.h>
#include <validation.h>
#include <arith_uint256.h>
#include <chain.h>
#include <checkqueue.h>
#include <clientversion.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/merkle.h>
#include <consensus/tx_check.h>
#include <consensus/tx_verify.h>
#include <consensus/validation.h>
#include <cuckoocache.h>
#include <flatfile.h>
#include <hash.h>
#include <kernel/chainparams.h>
#include <kernel/coinstats.h>
#include <kernel/disconnected_transactions.h>
#include <kernel/mempool_entry.h>
#include <kernel/messagestartchars.h>
#include <kernel/notifications_interface.h>
#include <kernel/types.h>
#include <kernel/warning.h>
#include <logging/timer.h>
#include <node/blockstorage.h>
#include <node/utxo_snapshot.h>
#include <policy/ephemeral_policy.h>
#include <policy/policy.h>
#include <policy/rbf.h>
#include <policy/settings.h>
#include <policy/truc_policy.h>
#include <pow.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <random.h>
#include <script/script.h>
#include <script/sigcache.h>
#include <signet.h>
#include <tinyformat.h>
#include <txdb.h>
#include <txmempool.h>
#include <uint256.h>
#include <undo.h>
#include <util/check.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/hasher.h>
#include <util/log.h>
#include <util/moneystr.h>
#include <util/rbf.h>
#include <util/result.h>
#include <util/signalinterrupt.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/time.h>
#include <util/trace.h>
#include <util/translation.h>
#include <validationinterface.h>
#include <algorithm>
#include <cassert>
#include <chrono>
#include <deque>
#include <numeric>
#include <optional>
#include <ranges>
#include <span>
#include <string>
#include <tuple>
#include <utility>

Go to the source code of this file.

Classes

struct  PerBlockConnectTrace
class  ConnectTrace
 Used to track blocks whose transactions were applied to the UTXO state as a part of a single ActivateBestChainStep call. More...
struct  StopHashingException
class  Notifications
 A base class defining functions for notifying about certain kernel events. More...
struct  CBlockIndexHeightOnlyComparator
struct  CBlockIndexWorkComparator

Typedefs

using FopenFn
using BlockMap

Enumerations

enum class  CoinStatsHashType

Functions

 TRACEPOINT_SEMAPHORE (validation, block_connected)
 TRACEPOINT_SEMAPHORE (utxocache, flush)
 TRACEPOINT_SEMAPHORE (mempool, replaced)
 TRACEPOINT_SEMAPHORE (mempool, rejected)
bool CheckInputScripts (const CTransaction &tx, TxValidationState &state, const CCoinsViewCache &inputs, script_verify_flags flags, bool cacheSigStore, bool cacheFullScriptStore, PrecomputedTransactionData &txdata, ValidationCache &validation_cache, std::vector< CScriptCheck > *pvChecks)
 Check whether all of this transaction's input scripts succeed.
bool CheckFinalTxAtTip (const CBlockIndex &active_chain_tip, const CTransaction &tx)
std::optional< LockPointsCalculateLockPointsAtTip (CBlockIndex *tip, const CCoinsView &coins_view, const CTransaction &tx)
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.
static void LimitMempoolSize (CTxMemPool &pool, CCoinsViewCache &coins_cache) EXCLUSIVE_LOCKS_REQUIRED(
static bool IsCurrentForFeeEstimation (Chainstate &active_chainstate) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
static bool CheckInputsFromMempoolAndCache (const CTransaction &tx, TxValidationState &state, const CCoinsViewCache &view, const CTxMemPool &pool, script_verify_flags flags, PrecomputedTransactionData &txdata, CCoinsViewCache &coins_tip, ValidationCache &validation_cache) EXCLUSIVE_LOCKS_REQUIRED(cs_main
 Checks to avoid mempool polluting consensus critical paths since cached signature and script validity results will be reused if we validate this transaction again during block validation.
 AssertLockHeld (pool.cs)
 assert (!tx.IsCoinBase())
 for (const CTxIn &txin :tx.vin)
return CheckInputScripts (tx, state, view, flags, true, true, txdata, validation_cache)
MempoolAcceptResult AcceptToMemoryPool (Chainstate &active_chainstate, const CTransactionRef &tx, int64_t accept_time, bool bypass_limits, bool test_accept)
 Try to add a transaction to the mempool.
PackageMempoolAcceptResult ProcessNewPackage (Chainstate &active_chainstate, CTxMemPool &pool, const Package &package, bool test_accept, const std::optional< CFeeRate > &client_maxfeerate)
 Validate (and maybe submit) a package to the mempool.
CAmount GetBlockSubsidy (int nHeight, const Consensus::Params &consensusParams)
void UpdateCoins (const CTransaction &tx, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight)
bool FatalError (Notifications &notifications, BlockValidationState &state, const bilingual_str &message)
int ApplyTxInUndo (Coin &&undo, CCoinsViewCache &view, const COutPoint &out)
 Restore the UTXO in a Coin at a given COutPoint.
script_verify_flags GetBlockScriptFlags (const CBlockIndex &block_index, const ChainstateManager &chainman)
static void UpdateTipLog (const ChainstateManager &chainman, const CCoinsViewCache &coins_tip, const CBlockIndex *tip, const std::string &func_name, const std::string &prefix, const std::string &warning_messages) EXCLUSIVE_LOCKS_REQUIRED(
static SynchronizationState GetSynchronizationState (bool init, bool blockfiles_indexed)
static void LimitValidationInterfaceQueue (ValidationSignals &signals) LOCKS_EXCLUDED(cs_main)
static bool CheckBlockHeader (const CBlockHeader &block, BlockValidationState &state, const Consensus::Params &consensusParams, bool fCheckPOW=true)
static bool CheckMerkleRoot (const CBlock &block, BlockValidationState &state)
static bool CheckWitnessMalleation (const CBlock &block, bool expect_witness_commitment, BlockValidationState &state)
 CheckWitnessMalleation performs checks for block malleation with regard to its witnesses.
bool CheckBlock (const CBlock &block, BlockValidationState &state, const Consensus::Params &consensusParams, bool fCheckPOW, bool fCheckMerkleRoot)
 Functions for validating blocks and updating the block tree.
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.
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).
arith_uint256 CalculateClaimedHeadersWork (std::span< const CBlockHeader > headers)
 Return the sum of the claimed work on a given set of headers.
static bool ContextualCheckBlockHeader (const CBlockHeader &block, BlockValidationState &state, BlockManager &blockman, const ChainstateManager &chainman, const CBlockIndex *pindexPrev) EXCLUSIVE_LOCKS_REQUIRED(
 Context-dependent validity checks.
static bool ContextualCheckBlock (const CBlock &block, BlockValidationState &state, const ChainstateManager &chainman, const CBlockIndex *pindexPrev)
 NOTE: This function is not currently invoked by ConnectBlock(), so we should consider upgrade issues if we change which consensus rules are enforced in this function (eg by adding a new consensus rule).
BlockValidationState TestBlockValidity (Chainstate &chainstate, const CBlock &block, const bool check_pow, const bool check_merkle_root)
 Verify a block, including transactions.
void PruneBlockFilesManual (Chainstate &active_chainstate, int nManualPruneHeight)
 Prune block files up to a given height.
static bool DeleteCoinsDBFromDisk (const fs::path db_path, bool is_snapshot) EXCLUSIVE_LOCKS_REQUIRED(
static void FlushSnapshotToDisk (CCoinsViewCache &coins_cache, bool snapshot_loaded)
static void SnapshotUTXOHashBreakpoint (const util::SignalInterrupt &interrupt)
static ChainstateManager::Options && Flatten (ChainstateManager::Options &&opts)
 Apply default chain params to nullopt members.
bool IsBIP30Repeat (const CBlockIndex &block_index)
 Identifies blocks that overwrote an existing coinbase output in the UTXO set (see BIP30).
bool IsBIP30Unspendable (const uint256 &block_hash, int block_height)
 Identifies blocks which coinbase output was subsequently overwritten in the UTXO set (see BIP30).
template<typename T>
static bool ComputeUTXOStats (CCoinsView *view, CCoinsStats &stats, T hash_obj, const std::function< void()> &interruption_point, std::unique_ptr< CCoinsViewCursor > pcursor)
 Calculate statistics about the unspent transaction output set.

Variables

static constexpr auto DATABASE_WRITE_INTERVAL_MIN {50min}
 Time window to wait between writing blocks/block index and chainstate to disk.
static constexpr auto DATABASE_WRITE_INTERVAL_MAX {70min}
static constexpr std::chrono::hours MAX_FEE_ESTIMATION_TIP_AGE {3}
 Maximum age of our tip for us to be considered current for fee estimation.
const std::vector< std::string > CHECKLEVEL_DOC
 Documentation for argument 'checklevel'.
static constexpr int PRUNE_LOCK_BUFFER {10}
 The number of blocks to keep below the deepest prune lock.
static bool pool cs

Typedef Documentation

◆ BlockMap

Definition at line 135 of file blockstorage.h.

◆ FopenFn

Definition at line 192 of file fs.h.

Enumeration Type Documentation

◆ CoinStatsHashType

enum class kernel::CoinStatsHashType
strong

Definition at line 26 of file coinstats.h.

Function Documentation

◆ AcceptToMemoryPool()

MempoolAcceptResult AcceptToMemoryPool ( Chainstate & active_chainstate,
const CTransactionRef & tx,
int64_t accept_time,
bool bypass_limits,
bool test_accept )

Try to add a transaction to the mempool.

This is an internal function and is exposed only for testing. Client code should use ChainstateManager::ProcessTransaction()

Parameters
[in]active_chainstateReference to the active chainstate.
[in]txThe transaction to submit for mempool acceptance.
[in]accept_timeThe timestamp for adding the transaction to the mempool. It is also used to determine when the entry expires.
[in]bypass_limitsWhen true, don't enforce mempool fee and capacity limits, and set entry_sequence to zero.
[in]test_acceptWhen true, run validation checks but don't submit to mempool.
Returns
a MempoolAcceptResult indicating whether the transaction was accepted/rejected with reason.

Definition at line 1772 of file validation.cpp.

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

◆ ApplyTxInUndo()

int ApplyTxInUndo ( Coin && undo,
CCoinsViewCache & view,
const COutPoint & out )

Restore the UTXO in a Coin at a given COutPoint.

Parameters
undoThe Coin to be restored.
viewThe coins view to which to apply the changes.
outThe out point that corresponds to the tx input.
Returns
A DisconnectResult as an int

Definition at line 2146 of file validation.cpp.

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

◆ assert()

assert ( !tx. IsCoinBase())

◆ AssertLockHeld()

AssertLockHeld ( pool. cs)

◆ CalculateClaimedHeadersWork()

arith_uint256 CalculateClaimedHeadersWork ( std::span< const CBlockHeader > headers)

Return the sum of the claimed work on a given set of headers.

No verification of PoW is done.

Definition at line 4090 of file validation.cpp.

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

◆ CalculateLockPointsAtTip()

std::optional< LockPoints > CalculateLockPointsAtTip ( CBlockIndex * tip,
const CCoinsView & coins_view,
const CTransaction & tx )

Definition at line 201 of file validation.cpp.

Here is the call graph for this function:

◆ CheckBlock()

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.

Context-independent validity checks

Definition at line 3950 of file validation.cpp.

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

◆ CheckBlockHeader()

bool CheckBlockHeader ( const CBlockHeader & block,
BlockValidationState & state,
const Consensus::Params & consensusParams,
bool fCheckPOW = true )
static

Definition at line 3860 of file validation.cpp.

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

◆ CheckFinalTxAtTip()

bool CheckFinalTxAtTip ( const CBlockIndex & active_chain_tip,
const CTransaction & tx )

Definition at line 147 of file validation.cpp.

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

◆ CheckInputScripts() [1/2]

bool CheckInputScripts ( const CTransaction & tx,
TxValidationState & state,
const CCoinsViewCache & inputs,
script_verify_flags flags,
bool cacheSigStore,
bool cacheFullScriptStore,
PrecomputedTransactionData & txdata,
ValidationCache & validation_cache,
std::vector< CScriptCheck > * pvChecks )

Check whether all of this transaction's input scripts succeed.

This involves ECDSA signature checks so can be computationally intensive. This function should only be called after the cheap sanity checks in CheckTxInputs passed.

If pvChecks is not nullptr, script checks are pushed onto it instead of being performed inline. Any script checks which are not necessary (eg due to script execution cache hits) are, obviously, not pushed onto pvChecks/run.

Setting cacheSigStore/cacheFullScriptStore to false will remove elements from the corresponding cache which are matched. This is useful for checking blocks where we will likely never need the cache entry again.

Note that we may set state.reason to NOT_STANDARD for extra soft-fork flags in flags, block-checking callers should probably reset it to CONSENSUS in such cases.

Non-static (and redeclared) in src/test/txvalidationcache_tests.cpp

Definition at line 2058 of file validation.cpp.

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

◆ CheckInputScripts() [2/2]

return CheckInputScripts ( tx ,
state ,
view ,
flags ,
true ,
true ,
txdata ,
validation_cache  )

◆ CheckInputsFromMempoolAndCache()

bool CheckInputsFromMempoolAndCache ( const CTransaction & tx,
TxValidationState & state,
const CCoinsViewCache & view,
const CTxMemPool & pool,
script_verify_flags flags,
PrecomputedTransactionData & txdata,
CCoinsViewCache & coins_tip,
ValidationCache & validation_cache )
static

Checks to avoid mempool polluting consensus critical paths since cached signature and script validity results will be reused if we validate this transaction again during block validation.

◆ CheckMerkleRoot()

bool CheckMerkleRoot ( const CBlock & block,
BlockValidationState & state )
static

Definition at line 3869 of file validation.cpp.

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

◆ CheckSequenceLocksAtTip()

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.

Parameters
[in]tipChain tip to check tx sequence locks against. For example, the tip of the current active chain.
[in]lock_pointsLockPoints containing the height and time at which this transaction is final. Simulates calling SequenceLocks() with data from the tip passed in. The LockPoints should not be considered valid if CheckSequenceLocksAtTip returns false.

Definition at line 246 of file validation.cpp.

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

◆ CheckWitnessMalleation()

bool CheckWitnessMalleation ( const CBlock & block,
bool expect_witness_commitment,
BlockValidationState & state )
static

CheckWitnessMalleation performs checks for block malleation with regard to its witnesses.

Note: If the witness commitment is expected (i.e. expect_witness_commitment = true), then the block is required to have at least one transaction and the first transaction needs to have at least one input.

Definition at line 3902 of file validation.cpp.

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

◆ ComputeUTXOStats()

template<typename T>
bool kernel::ComputeUTXOStats ( CCoinsView * view,
CCoinsStats & stats,
T hash_obj,
const std::function< void()> & interruption_point,
std::unique_ptr< CCoinsViewCursor > pcursor )
static

Calculate statistics about the unspent transaction output set.

Definition at line 112 of file coinstats.cpp.

Here is the caller graph for this function:

◆ ContextualCheckBlock()

bool ContextualCheckBlock ( const CBlock & block,
BlockValidationState & state,
const ChainstateManager & chainman,
const CBlockIndex * pindexPrev )
static

NOTE: This function is not currently invoked by ConnectBlock(), so we should consider upgrade issues if we change which consensus rules are enforced in this function (eg by adding a new consensus rule).

See comment in ConnectBlock(). Note that -reindex-chainstate skips the validation that happens here!

Definition at line 4161 of file validation.cpp.

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

◆ ContextualCheckBlockHeader()

bool ContextualCheckBlockHeader ( const CBlockHeader & block,
BlockValidationState & state,
BlockManager & blockman,
const ChainstateManager & chainman,
const CBlockIndex * pindexPrev )
static

Context-dependent validity checks.

By "context", we mean only the previous block headers, but not the UTXO set; UTXO-related validity checks are done in ConnectBlock(). NOTE: This function is not currently invoked by ConnectBlock(), so we should consider upgrade issues if we change which consensus rules are enforced in this function (eg by adding a new consensus rule). See comment in ConnectBlock(). Note that -reindex-chainstate skips the validation that happens here!

NOTE: failing to check the header's height against the last checkpoint's opened a DoS vector between v0.12 and v0.15 (when no additional protection was in place) whereby an attacker could unboundedly grow our in-memory block index. See https://bitcoincore.org/en/2024/07/03/disclose-header-spam.

Definition at line 4112 of file validation.cpp.

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

◆ DeleteCoinsDBFromDisk()

bool DeleteCoinsDBFromDisk ( const fs::path db_path,
bool is_snapshot )
staticnodiscard

Definition at line 5567 of file validation.cpp.

Here is the call graph for this function:

◆ FatalError()

bool FatalError ( Notifications & notifications,
BlockValidationState & state,
const bilingual_str & message )

Definition at line 2133 of file validation.cpp.

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

◆ Flatten()

Apply default chain params to nullopt members.

This helps to avoid coding errors around the accidental use of the compare operators that accept nullopt, thus ignoring the intended default value.

Definition at line 6146 of file validation.cpp.

Here is the call graph for this function:

◆ FlushSnapshotToDisk()

void FlushSnapshotToDisk ( CCoinsViewCache & coins_cache,
bool snapshot_loaded )
static

Definition at line 5749 of file validation.cpp.

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

◆ for()

for ( const CTxIn &txin :tx. vin)

Definition at line 405 of file validation.cpp.

Here is the call graph for this function:

◆ GetBlockScriptFlags()

script_verify_flags GetBlockScriptFlags ( const CBlockIndex & block_index,
const ChainstateManager & chainman )

Definition at line 2247 of file validation.cpp.

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

◆ GetBlockSubsidy()

CAmount GetBlockSubsidy ( int nHeight,
const Consensus::Params & consensusParams )

Definition at line 1836 of file validation.cpp.

Here is the caller graph for this function:

◆ GetSynchronizationState()

SynchronizationState GetSynchronizationState ( bool init,
bool blockfiles_indexed )
static

Definition at line 3307 of file validation.cpp.

Here is the caller graph for this function:

◆ HasValidProofOfWork()

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.

Definition at line 4053 of file validation.cpp.

Here is the call graph for this function:

◆ IsBIP30Repeat()

bool IsBIP30Repeat ( const CBlockIndex & block_index)

Identifies blocks that overwrote an existing coinbase output in the UTXO set (see BIP30).

Definition at line 6208 of file validation.cpp.

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

◆ IsBIP30Unspendable()

bool IsBIP30Unspendable ( const uint256 & block_hash,
int block_height )

Identifies blocks which coinbase output was subsequently overwritten in the UTXO set (see BIP30).

Definition at line 6214 of file validation.cpp.

Here is the caller graph for this function:

◆ IsBlockMutated()

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).

Definition at line 4059 of file validation.cpp.

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

◆ IsCurrentForFeeEstimation()

bool IsCurrentForFeeEstimation ( Chainstate & active_chainstate)
static

Definition at line 280 of file validation.cpp.

Here is the call graph for this function:

◆ LimitMempoolSize()

void LimitMempoolSize ( CTxMemPool & pool,
CCoinsViewCache & coins_cache )
static

Definition at line 264 of file validation.cpp.

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

◆ LimitValidationInterfaceQueue()

void LimitValidationInterfaceQueue ( ValidationSignals & signals)
static

Definition at line 3346 of file validation.cpp.

◆ ProcessNewPackage()

PackageMempoolAcceptResult ProcessNewPackage ( Chainstate & active_chainstate,
CTxMemPool & pool,
const Package & txns,
bool test_accept,
const std::optional< CFeeRate > & client_maxfeerate )

Validate (and maybe submit) a package to the mempool.

See doc/policy/packages.md for full details on package validation rules.

Parameters
[in]test_acceptWhen true, run validation checks but don't submit to mempool.
[in]client_maxfeerateIf exceeded by an individual transaction, rest of (sub)package evaluation is aborted. Only for sanity checks against local submission of transactions.
Returns
a PackageMempoolAcceptResult which includes a MempoolAcceptResult for each transaction. If a transaction fails, validation will exit early and some results may be missing. It is also possible for the package to be partially submitted.

Definition at line 1804 of file validation.cpp.

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

◆ PruneBlockFilesManual()

void PruneBlockFilesManual ( Chainstate & active_chainstate,
int nManualPruneHeight )

Prune block files up to a given height.

Definition at line 4569 of file validation.cpp.

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

◆ SnapshotUTXOHashBreakpoint()

void SnapshotUTXOHashBreakpoint ( const util::SignalInterrupt & interrupt)
static

Definition at line 5768 of file validation.cpp.

Here is the caller graph for this function:

◆ TestBlockValidity()

BlockValidationState TestBlockValidity ( Chainstate & chainstate,
const CBlock & block,
bool check_pow,
bool check_merkle_root )

Verify a block, including transactions.

Parameters
[in]blockThe block we want to process. Must connect to the current tip.
[in]chainstateThe chainstate to connect to.
[in]check_powperform proof-of-work check, nBits in the header is always checked
[in]check_merkle_rootcheck the merkle root
Returns
Valid or Invalid state. This doesn't currently return an Error state, and shouldn't unless there is something wrong with the existing chainstate. (This is different from functions like AcceptBlock which can fail trying to save new data.)

For signets the challenge verification is skipped when check_pow is false.

At this point ProcessNewBlock would call AcceptBlock(), but we don't want to store the block or its header. Run individual checks instead:

Definition at line 4495 of file validation.cpp.

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

◆ TRACEPOINT_SEMAPHORE() [1/4]

TRACEPOINT_SEMAPHORE ( mempool ,
rejected  )

◆ TRACEPOINT_SEMAPHORE() [2/4]

TRACEPOINT_SEMAPHORE ( mempool ,
replaced  )

◆ TRACEPOINT_SEMAPHORE() [3/4]

TRACEPOINT_SEMAPHORE ( utxocache ,
flush  )

◆ TRACEPOINT_SEMAPHORE() [4/4]

TRACEPOINT_SEMAPHORE ( validation ,
block_connected  )

◆ UpdateCoins()

void UpdateCoins ( const CTransaction & tx,
CCoinsViewCache & inputs,
CTxUndo & txundo,
int nHeight )

Definition at line 1996 of file validation.cpp.

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

◆ UpdateTipLog()

void UpdateTipLog ( const ChainstateManager & chainman,
const CCoinsViewCache & coins_tip,
const CBlockIndex * tip,
const std::string & func_name,
const std::string & prefix,
const std::string & warning_messages )
static

Definition at line 2855 of file validation.cpp.

Here is the call graph for this function:

Variable Documentation

◆ CHECKLEVEL_DOC

const std::vector<std::string> CHECKLEVEL_DOC
Initial value:
{
"level 0 reads the blocks from disk",
"level 1 verifies block validity",
"level 2 verifies undo data",
"level 3 checks disconnection of tip blocks",
"level 4 tries to reconnect the blocks",
"each level includes the checks of the previous levels",
}

Documentation for argument 'checklevel'.

Definition at line 100 of file validation.cpp.

◆ cs

bool pool cs
Initial value:
{
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
Definition cs_main.cpp:8
#define AssertLockHeld(cs)
Definition sync.h:136

Definition at line 399 of file validation.cpp.

◆ DATABASE_WRITE_INTERVAL_MAX

auto DATABASE_WRITE_INTERVAL_MAX {70min}
staticconstexpr

Definition at line 97 of file validation.cpp.

◆ DATABASE_WRITE_INTERVAL_MIN

auto DATABASE_WRITE_INTERVAL_MIN {50min}
staticconstexpr

Time window to wait between writing blocks/block index and chainstate to disk.

Randomize writing time inside the window to prevent a situation where the network over time settles into a few cohorts of synchronized writers.

Definition at line 96 of file validation.cpp.

◆ MAX_FEE_ESTIMATION_TIP_AGE

std::chrono::hours MAX_FEE_ESTIMATION_TIP_AGE {3}
staticconstexpr

Maximum age of our tip for us to be considered current for fee estimation.

Definition at line 99 of file validation.cpp.

◆ PRUNE_LOCK_BUFFER

int PRUNE_LOCK_BUFFER {10}
staticconstexpr

The number of blocks to keep below the deepest prune lock.

There is nothing special about this number. It is higher than what we expect to see in regular mainnet reorgs, but not so high that it would noticeably interfere with the pruning mechanism.

Definition at line 113 of file validation.cpp.