Bitcoin ABC  0.26.3
P2P Digital Currency
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
validation.h File Reference
#include <amount.h>
#include <attributes.h>
#include <blockfileinfo.h>
#include <blockindexworkcomparator.h>
#include <coins.h>
#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <disconnectresult.h>
#include <flatfile.h>
#include <fs.h>
#include <node/utxo_snapshot.h>
#include <protocol.h>
#include <script/script_error.h>
#include <script/script_metrics.h>
#include <sync.h>
#include <txdb.h>
#include <txmempool.h>
#include <util/check.h>
#include <util/translation.h>
#include <versionbits.h>
#include <atomic>
#include <cstdint>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <thread>
#include <utility>
#include <vector>
Include dependency graph for validation.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  BlockValidationOptions
 
struct  MempoolAcceptResult
 Validation result for a single transaction mempool acceptance. More...
 
class  CheckInputsLimiter
 Simple class for regulating resource usage during CheckInputScripts (and CScriptCheck), atomic so as to be compatible with parallel validation. More...
 
class  TxSigCheckLimiter
 
class  CScriptCheck
 Closure representing one script verification. More...
 
class  CVerifyDB
 RAII wrapper for VerifyDB: Verify consistency of the block and coin databases. More...
 
class  BlockManager
 Maintains a tree of blocks (stored in m_block_index) which is consulted to determine where the most-work tip is. More...
 
class  CoinsViews
 A convenience class for constructing the CCoinsView* hierarchy used to facilitate access to the UTXO set. More...
 
class  CChainState
 CChainState stores and provides an API to update our local knowledge of the current best chain. More...
 
class  ChainstateManager
 Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate generated by downloading blocks, and an optional snapshot chainstate loaded from a UTXO snapshot. More...
 

Namespaces

 Consensus
 

Macros

#define MIN_TRANSACTION_SIZE    (::GetSerializeSize(CTransaction(), PROTOCOL_VERSION))
 

Typedefs

typedef std::unordered_map< BlockHash, CBlockIndex *, BlockHasherBlockMap
 

Enumerations

enum class  SynchronizationState { INIT_REINDEX , INIT_DOWNLOAD , POST_INIT }
 Current sync state passed to tip changed callbacks. More...
 
enum class  FlushStateMode { NONE , IF_NEEDED , PERIODIC , ALWAYS }
 
enum class  CoinsCacheSizeState { CRITICAL = 2 , LARGE = 1 , OK = 0 }
 

Functions

static const Amount DEFAULT_MIN_RELAY_TX_FEE_PER_KB (1000 *SATOSHI)
 Default for -minrelaytxfee, minimum relay fee for transactions. More...
 
void UnloadBlockIndex (CTxMemPool *mempool, ChainstateManager &chainman)
 Unload database information. More...
 
void StartScriptCheckWorkerThreads (int threads_num)
 Run instances of script checking worker threads. More...
 
void StopScriptCheckWorkerThreads ()
 Stop all of the script checking worker threads. More...
 
CTransactionRef GetTransaction (const CBlockIndex *const block_index, const CTxMemPool *const mempool, const TxId &txid, const Consensus::Params &consensusParams, BlockHash &hashBlock)
 Return transaction from the block at block_index. More...
 
Amount GetBlockSubsidy (int nHeight, const Consensus::Params &consensusParams)
 
bool AbortNode (BlockValidationState &state, const std::string &strMessage, const bilingual_str &userMessage=bilingual_str{})
 
double GuessVerificationProgress (const ChainTxData &data, const CBlockIndex *pindex)
 Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). More...
 
void PruneBlockFilesManual (CChainState &active_chainstate, int nManualPruneHeight)
 Prune block files up to a given height. More...
 
MempoolAcceptResult AcceptToMemoryPool (CChainState &active_chainstate, const Config &config, CTxMemPool &pool, const CTransactionRef &tx, bool bypass_limits, bool test_accept=false) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 (try to) add transaction to memory pool More...
 
bool CheckInputScripts (const CTransaction &tx, TxValidationState &state, const CCoinsViewCache &view, const uint32_t flags, bool sigCacheStore, bool scriptCacheStore, const PrecomputedTransactionData &txdata, int &nSigChecksOut, TxSigCheckLimiter &txLimitSigChecks, CheckInputsLimiter *pBlockLimitSigChecks, std::vector< CScriptCheck > *pvChecks) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 Check whether all of this transaction's input scripts succeed. More...
 
static bool CheckInputScripts (const CTransaction &tx, TxValidationState &state, const CCoinsViewCache &view, const uint32_t flags, bool sigCacheStore, bool scriptCacheStore, const PrecomputedTransactionData &txdata, int &nSigChecksOut) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 Handy shortcut to full fledged CheckInputScripts call. More...
 
void SpendCoins (CCoinsViewCache &view, const CTransaction &tx, CTxUndo &txundo, int nHeight)
 Mark all the coins corresponding to a given transaction inputs as spent. More...
 
void UpdateCoins (CCoinsViewCache &view, const CTransaction &tx, int nHeight)
 Apply the effects of this transaction on the UTXO set represented by view. More...
 
void UpdateCoins (CCoinsViewCache &view, const CTransaction &tx, CTxUndo &txundo, int nHeight)
 
bool TestLockPointValidity (const CChain &active_chain, const LockPoints *lp) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 Test whether the LockPoints height and time are still valid on the current chain. More...
 
bool CheckSequenceLocks (CBlockIndex *tip, const CCoinsView &coins_view, const CTransaction &tx, int flags, LockPoints *lp=nullptr, bool useExistingLockPoints=false)
 Check if transaction will be BIP68 final in the next block to be created on top of tip. More...
 
bool CheckBlock (const CBlock &block, BlockValidationState &state, const Consensus::Params &params, BlockValidationOptions validationOptions)
 Functions for validating blocks and updating the block tree. More...
 
bool ContextualCheckTransactionForCurrentBlock (const CBlockIndex *active_chain_tip, const Consensus::Params &params, const CTransaction &tx, TxValidationState &state, int flags=-1) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 This is a variant of ContextualCheckTransaction which computes the contextual check for a transaction based on the chain tip. More...
 
bool TestBlockValidity (BlockValidationState &state, const CChainParams &params, CChainState &chainstate, const CBlock &block, CBlockIndex *pindexPrev, BlockValidationOptions validationOptions) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 Check a block is completely valid from start to finish (only works on top of our current best block) More...
 
int32_t ComputeBlockVersion (const CBlockIndex *pindexPrev, const Consensus::Params &params)
 Determine what nVersion a new block should use. More...
 
bool DumpMempool (const CTxMemPool &pool)
 Dump the mempool to disk. More...
 
bool LoadMempool (const Config &config, CTxMemPool &pool, CChainState &active_chainstate)
 Load the mempool from disk. More...
 
const AssumeutxoDataExpectedAssumeutxo (const int height, const CChainParams &params)
 Return the expected assumeutxo value for a given height, if one exists. More...
 

Variables

static const Amount DEFAULT_UTXO_FEE = Amount::zero()
 Default for -excessutxocharge for transactions transactions. More...
 
static const unsigned int DEFAULT_MEMPOOL_EXPIRY = 336
 Default for -mempoolexpiry, expiration time for mempool transactions in hours. More...
 
static const int MAX_SCRIPTCHECK_THREADS = 15
 Maximum number of dedicated script-checking threads allowed. More...
 
static const int DEFAULT_SCRIPTCHECK_THREADS = 0
 -par default (number of script-checking threads, 0 = auto) More...
 
static const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60
 
static const bool DEFAULT_CHECKPOINTS_ENABLED = true
 
static const bool DEFAULT_TXINDEX = false
 
static constexpr bool DEFAULT_COINSTATSINDEX {false}
 
static const char *const DEFAULT_BLOCKFILTERINDEX = "0"
 
static const bool DEFAULT_PERSIST_MEMPOOL = true
 Default for -persistmempool. More...
 
static const bool DEFAULT_FEEFILTER = true
 Default for using fee filter. More...
 
static const bool DEFAULT_PEERBLOOMFILTERS = true
 
static const int DEFAULT_STOPATHEIGHT = 0
 Default for -stopatheight. More...
 
static const int DEFAULT_MAX_REORG_DEPTH = 10
 Default for -maxreorgdepth. More...
 
static const int64_t DEFAULT_MIN_FINALIZATION_DELAY = 2 * 60 * 60
 Default for -finalizationdelay This is the minimum time between a block header reception and the block finalization. More...
 
static const unsigned int MIN_BLOCKS_TO_KEEP = 288
 Block files containing a block-height within MIN_BLOCKS_TO_KEEP of ActiveChain().Tip() will not be pruned. More...
 
static const signed int DEFAULT_CHECKBLOCKS = 6
 
static const unsigned int DEFAULT_CHECKLEVEL = 3
 
static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024
 Require that user allocate at least 550 MiB for block & undo files (blk???.dat and rev???.dat) At 1MB per block, 288 blocks = 288MB. More...
 
RecursiveMutex cs_main
 Global state. More...
 
Mutex g_best_block_mutex
 
std::condition_variable g_best_block_cv
 
uint256 g_best_block
 
bool fRequireStandard
 
bool fCheckBlockIndex
 
bool fCheckpointsEnabled
 
CFeeRate minRelayTxFee
 A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) More...
 
int64_t nMaxTipAge
 If the tip is older than this (in seconds), the node is considered to be in initial block download. More...
 
BlockHash hashAssumeValid
 Block hash whose ancestors we will assume to have valid scripts without checking them. More...
 
arith_uint256 nMinimumChainWork
 Minimum work we will assume exists on some valid chain. More...
 
CBlockIndexpindexBestHeader
 Best header we've seen so far (used for getheaders queries' starting points). More...
 
const std::vector< std::string > CHECKLEVEL_DOC
 Documentation for argument 'checklevel'. More...
 
std::unique_ptr< CCoinsViewCachepcoinsTip
 Global variable that points to the active CCoinsView (protected by cs_main) More...
 
std::unique_ptr< CBlockTreeDBpblocktree
 Global variable that points to the active block tree (protected by cs_main) More...
 
VersionBitsCache versionbitscache
 

Macro Definition Documentation

◆ MIN_TRANSACTION_SIZE

#define MIN_TRANSACTION_SIZE    (::GetSerializeSize(CTransaction(), PROTOCOL_VERSION))

Definition at line 73 of file validation.h.

Typedef Documentation

◆ BlockMap

typedef std::unordered_map<BlockHash, CBlockIndex *, BlockHasher> BlockMap

Definition at line 139 of file validation.h.

Enumeration Type Documentation

◆ CoinsCacheSizeState

enum CoinsCacheSizeState
strong
Enumerator
CRITICAL 

The coins cache is in immediate need of a flush.

LARGE 

The cache is at >= 90% capacity.

OK 

Definition at line 736 of file validation.h.

◆ FlushStateMode

enum FlushStateMode
strong
See also
CChainState::FlushStateToDisk
Enumerator
NONE 
IF_NEEDED 
PERIODIC 
ALWAYS 

Definition at line 558 of file validation.h.

◆ SynchronizationState

enum SynchronizationState
strong

Current sync state passed to tip changed callbacks.

Enumerator
INIT_REINDEX 
INIT_DOWNLOAD 
POST_INIT 

Definition at line 136 of file validation.h.

Function Documentation

◆ AbortNode()

bool AbortNode ( BlockValidationState state,
const std::string &  strMessage,
const bilingual_str userMessage = bilingual_str{} 
)

Definition at line 1187 of file validation.cpp.

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

◆ AcceptToMemoryPool()

MempoolAcceptResult AcceptToMemoryPool ( CChainState active_chainstate,
const Config config,
CTxMemPool pool,
const CTransactionRef tx,
bool  bypass_limits,
bool  test_accept = false 
)

(try to) add transaction to memory pool

Parameters
[in]bypass_limitsWhen true, don't enforce mempool fee limits.
[in]test_acceptWhen true, run validation checks but don't submit to mempool.

Definition at line 757 of file validation.cpp.

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

◆ CheckBlock()

bool CheckBlock ( const CBlock block,
BlockValidationState state,
const Consensus::Params params,
BlockValidationOptions  validationOptions 
)

Functions for validating blocks and updating the block tree.

Context-independent validity checks.

Returns true if the provided block is valid (has valid header, transactions are valid, block is a valid size, etc.)

Definition at line 3506 of file validation.cpp.

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

◆ CheckInputScripts() [1/2]

static bool CheckInputScripts ( const CTransaction tx,
TxValidationState state,
const CCoinsViewCache view,
const uint32_t  flags,
bool  sigCacheStore,
bool  scriptCacheStore,
const PrecomputedTransactionData txdata,
int &  nSigChecksOut 
)
inlinestatic

Handy shortcut to full fledged CheckInputScripts call.

Definition at line 401 of file validation.h.

Here is the call graph for this function:

◆ CheckInputScripts() [2/2]

bool CheckInputScripts ( const CTransaction tx,
TxValidationState state,
const CCoinsViewCache view,
const uint32_t  flags,
bool  sigCacheStore,
bool  scriptCacheStore,
const PrecomputedTransactionData txdata,
int &  nSigChecksOut,
TxSigCheckLimiter txLimitSigChecks,
CheckInputsLimiter pBlockLimitSigChecks,
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.

Upon success nSigChecksOut will be filled in with either:

  • correct total for all inputs, or,
  • 0, in the case when checks were pushed onto pvChecks (i.e., a cache miss with pvChecks non-null), in which case the total can be found by executing pvChecks and adding the results.

Setting sigCacheStore/scriptCacheStore 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.

pLimitSigChecks can be passed to limit the sigchecks count either in parallel or serial validation. With pvChecks null (serial validation), breaking the pLimitSigChecks limit will abort evaluation early and return false. With pvChecks not-null (parallel validation): the cached nSigChecks may itself break the limit in which case false is returned, OR, each entry in the returned pvChecks must be executed exactly once in order to probe the limit accurately.

Definition at line 1082 of file validation.cpp.

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

◆ CheckSequenceLocks()

bool CheckSequenceLocks ( CBlockIndex tip,
const CCoinsView coins_view,
const CTransaction tx,
int  flags,
LockPoints lp = nullptr,
bool  useExistingLockPoints = false 
)

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]coins_viewAny CCoinsView that provides access to the relevant coins for checking sequence locks. Any CCoinsView can be passed in; it is assumed to be consistent with the tip. Simulates calling SequenceLocks() with data from the tip passed in. Optionally stores in LockPoints the resulting height and time calculated and the hash of the block needed for calculation or skips the calculation and uses the LockPoints passed in for evaluation. The LockPoints should not be considered valid if CheckSequenceLocks returns false.

See consensus/consensus.h for flag definitions.

Definition at line 177 of file validation.cpp.

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

◆ ComputeBlockVersion()

int32_t ComputeBlockVersion ( const CBlockIndex pindexPrev,
const Consensus::Params params 
)

Determine what nVersion a new block should use.

Definition at line 1320 of file validation.cpp.

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

◆ ContextualCheckTransactionForCurrentBlock()

bool ContextualCheckTransactionForCurrentBlock ( const CBlockIndex active_chain_tip,
const Consensus::Params params,
const CTransaction tx,
TxValidationState state,
int  flags = -1 
)

This is a variant of ContextualCheckTransaction which computes the contextual check for a transaction based on the chain tip.

See consensus/consensus.h for flag definitions.

Definition at line 3692 of file validation.cpp.

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

◆ DEFAULT_MIN_RELAY_TX_FEE_PER_KB()

static const Amount DEFAULT_MIN_RELAY_TX_FEE_PER_KB ( 1000 *  SATOSHI)
static

Default for -minrelaytxfee, minimum relay fee for transactions.

Here is the caller graph for this function:

◆ DumpMempool()

bool DumpMempool ( const CTxMemPool pool)

Dump the mempool to disk.

Definition at line 5590 of file validation.cpp.

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

◆ ExpectedAssumeutxo()

const AssumeutxoData* ExpectedAssumeutxo ( const int  height,
const CChainParams params 
)

Return the expected assumeutxo value for a given height, if one exists.

Parameters
[in]heightGet the assumeutxo value for this height.
Returns
empty if no assumeutxo configuration exists for the given height.

Definition at line 5725 of file validation.cpp.

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

◆ GetBlockSubsidy()

Amount GetBlockSubsidy ( int  nHeight,
const Consensus::Params consensusParams 
)

Definition at line 799 of file validation.cpp.

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

◆ GetTransaction()

CTransactionRef GetTransaction ( const CBlockIndex *const  block_index,
const CTxMemPool *const  mempool,
const TxId txid,
const Consensus::Params consensusParams,
BlockHash hashBlock 
)

Return transaction from the block at block_index.

If block_index is not provided, fall back to mempool. If mempool is not provided or the tx couldn't be found in mempool, fall back to g_txindex.

Parameters
[in]block_indexThe block to read from disk, or nullptr
[in]mempoolIf block_index is not provided, look in the mempool, if provided
[in]txidThe txid
[in]consensusParamsThe params
[out]hashBlockThe hash of block_index, if the tx was found via block_index
Returns
The tx if found, otherwise nullptr

Definition at line 765 of file validation.cpp.

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

◆ GuessVerificationProgress()

double GuessVerificationProgress ( const ChainTxData data,
const CBlockIndex pindex 
)

Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip).

Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip).

Definition at line 5660 of file validation.cpp.

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

◆ LoadMempool()

bool LoadMempool ( const Config config,
CTxMemPool pool,
CChainState active_chainstate 
)

Load the mempool from disk.

Definition at line 5491 of file validation.cpp.

Here is the call graph for this function:

◆ PruneBlockFilesManual()

void PruneBlockFilesManual ( CChainState active_chainstate,
int  nManualPruneHeight 
)

Prune block files up to a given height.

Definition at line 4298 of file validation.cpp.

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

◆ SpendCoins()

void SpendCoins ( CCoinsViewCache view,
const CTransaction tx,
CTxUndo txundo,
int  nHeight 
)

Mark all the coins corresponding to a given transaction inputs as spent.

Definition at line 1021 of file validation.cpp.

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

◆ StartScriptCheckWorkerThreads()

void StartScriptCheckWorkerThreads ( int  threads_num)

Run instances of script checking worker threads.

Definition at line 1310 of file validation.cpp.

Here is the caller graph for this function:

◆ StopScriptCheckWorkerThreads()

void StopScriptCheckWorkerThreads ( )

Stop all of the script checking worker threads.

Definition at line 1314 of file validation.cpp.

Here is the caller graph for this function:

◆ TestBlockValidity()

bool TestBlockValidity ( BlockValidationState state,
const CChainParams params,
CChainState chainstate,
const CBlock block,
CBlockIndex pindexPrev,
BlockValidationOptions  validationOptions 
)

Check a block is completely valid from start to finish (only works on top of our current best block)

Definition at line 4192 of file validation.cpp.

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

◆ TestLockPointValidity()

bool TestLockPointValidity ( const CChain active_chain,
const LockPoints lp 
)

Test whether the LockPoints height and time are still valid on the current chain.

Definition at line 158 of file validation.cpp.

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

◆ UnloadBlockIndex()

void UnloadBlockIndex ( CTxMemPool mempool,
ChainstateManager chainman 
)

Unload database information.

Definition at line 4899 of file validation.cpp.

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

◆ UpdateCoins() [1/2]

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

Definition at line 1036 of file validation.cpp.

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

◆ UpdateCoins() [2/2]

void UpdateCoins ( CCoinsViewCache view,
const CTransaction tx,
int  nHeight 
)

Apply the effects of this transaction on the UTXO set represented by view.

Definition at line 1042 of file validation.cpp.

Here is the call graph for this function:

Variable Documentation

◆ CHECKLEVEL_DOC

const std::vector<std::string> CHECKLEVEL_DOC
extern

Documentation for argument 'checklevel'.

Definition at line 70 of file validation.cpp.

◆ cs_main

RecursiveMutex cs_main
extern

Global state.

Mutex to guard access to validation specific variables, such as reading or changing the chainstate.

This may also need to be locked when updating the transaction pool, e.g. on AcceptToMemoryPool. See CTxMemPool::cs comment for details.

The transaction pool has a separate lock to allow reading from it and the chainstate at the same time.

Definition at line 91 of file validation.cpp.

◆ DEFAULT_BLOCKFILTERINDEX

const char* const DEFAULT_BLOCKFILTERINDEX = "0"
static

Definition at line 93 of file validation.h.

◆ DEFAULT_CHECKBLOCKS

const signed int DEFAULT_CHECKBLOCKS = 6
static

Definition at line 118 of file validation.h.

◆ DEFAULT_CHECKLEVEL

const unsigned int DEFAULT_CHECKLEVEL = 3
static

Definition at line 119 of file validation.h.

◆ DEFAULT_CHECKPOINTS_ENABLED

const bool DEFAULT_CHECKPOINTS_ENABLED = true
static

Definition at line 90 of file validation.h.

◆ DEFAULT_COINSTATSINDEX

constexpr bool DEFAULT_COINSTATSINDEX {false}
staticconstexpr

Definition at line 92 of file validation.h.

◆ DEFAULT_FEEFILTER

const bool DEFAULT_FEEFILTER = true
static

Default for using fee filter.

Definition at line 98 of file validation.h.

◆ DEFAULT_MAX_REORG_DEPTH

const int DEFAULT_MAX_REORG_DEPTH = 10
static

Default for -maxreorgdepth.

Definition at line 105 of file validation.h.

◆ DEFAULT_MAX_TIP_AGE

const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60
static

Definition at line 89 of file validation.h.

◆ DEFAULT_MEMPOOL_EXPIRY

const unsigned int DEFAULT_MEMPOOL_EXPIRY = 336
static

Default for -mempoolexpiry, expiration time for mempool transactions in hours.

Definition at line 84 of file validation.h.

◆ DEFAULT_MIN_FINALIZATION_DELAY

const int64_t DEFAULT_MIN_FINALIZATION_DELAY = 2 * 60 * 60
static

Default for -finalizationdelay This is the minimum time between a block header reception and the block finalization.

This value should be >> block propagation and validation time

Definition at line 112 of file validation.h.

◆ DEFAULT_PEERBLOOMFILTERS

const bool DEFAULT_PEERBLOOMFILTERS = true
static

Definition at line 100 of file validation.h.

◆ DEFAULT_PERSIST_MEMPOOL

const bool DEFAULT_PERSIST_MEMPOOL = true
static

Default for -persistmempool.

Definition at line 96 of file validation.h.

◆ DEFAULT_SCRIPTCHECK_THREADS

const int DEFAULT_SCRIPTCHECK_THREADS = 0
static

-par default (number of script-checking threads, 0 = auto)

Definition at line 88 of file validation.h.

◆ DEFAULT_STOPATHEIGHT

const int DEFAULT_STOPATHEIGHT = 0
static

Default for -stopatheight.

Definition at line 103 of file validation.h.

◆ DEFAULT_TXINDEX

const bool DEFAULT_TXINDEX = false
static

Definition at line 91 of file validation.h.

◆ DEFAULT_UTXO_FEE

const Amount DEFAULT_UTXO_FEE = Amount::zero()
static

Default for -excessutxocharge for transactions transactions.

Definition at line 79 of file validation.h.

◆ fCheckBlockIndex

bool fCheckBlockIndex
extern

Definition at line 98 of file validation.cpp.

◆ fCheckpointsEnabled

bool fCheckpointsEnabled
extern

Definition at line 99 of file validation.cpp.

◆ fRequireStandard

bool fRequireStandard
extern

Definition at line 97 of file validation.cpp.

◆ g_best_block

uint256 g_best_block
extern

Definition at line 96 of file validation.cpp.

◆ g_best_block_cv

std::condition_variable g_best_block_cv
extern

Definition at line 95 of file validation.cpp.

◆ g_best_block_mutex

Mutex g_best_block_mutex
extern

Definition at line 94 of file validation.cpp.

◆ hashAssumeValid

BlockHash hashAssumeValid
extern

Block hash whose ancestors we will assume to have valid scripts without checking them.

Definition at line 102 of file validation.cpp.

◆ MAX_SCRIPTCHECK_THREADS

const int MAX_SCRIPTCHECK_THREADS = 15
static

Maximum number of dedicated script-checking threads allowed.

Definition at line 86 of file validation.h.

◆ MIN_BLOCKS_TO_KEEP

const unsigned int MIN_BLOCKS_TO_KEEP = 288
static

Block files containing a block-height within MIN_BLOCKS_TO_KEEP of ActiveChain().Tip() will not be pruned.

Definition at line 117 of file validation.h.

◆ MIN_DISK_SPACE_FOR_BLOCK_FILES

const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024
static

Require that user allocate at least 550 MiB for block & undo files (blk???.dat and rev???.dat) At 1MB per block, 288 blocks = 288MB.

Add 15% for Undo data = 331MB Add 20% for Orphan block rate = 397MB We want the low water mark after pruning to be at least 397 MB and since we prune in full block file chunks, we need the high water mark which triggers the prune to be one 128MB block file + added 15% undo data = 147MB greater for a total of 545MB Setting the target to >= 550 MiB will make it likely we can respect the target.

Definition at line 133 of file validation.h.

◆ minRelayTxFee

CFeeRate minRelayTxFee
extern

A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation)

Definition at line 105 of file validation.cpp.

◆ nMaxTipAge

int64_t nMaxTipAge
extern

If the tip is older than this (in seconds), the node is considered to be in initial block download.

Definition at line 100 of file validation.cpp.

◆ nMinimumChainWork

arith_uint256 nMinimumChainWork
extern

Minimum work we will assume exists on some valid chain.

Definition at line 103 of file validation.cpp.

◆ pblocktree

std::unique_ptr<CBlockTreeDB> pblocktree
extern

Global variable that points to the active block tree (protected by cs_main)

Definition at line 153 of file validation.cpp.

◆ pcoinsTip

std::unique_ptr<CCoinsViewCache> pcoinsTip
extern

Global variable that points to the active CCoinsView (protected by cs_main)

◆ pindexBestHeader

CBlockIndex* pindexBestHeader
extern

Best header we've seen so far (used for getheaders queries' starting points).

Definition at line 93 of file validation.cpp.

◆ versionbitscache

VersionBitsCache versionbitscache
extern