Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

validation.h File Reference
#include <amount.h>
#include <coins.h>
#include <fs.h>
#include <protocol.h>
#include <policy/feerate.h>
#include <script/script_error.h>
#include <sync.h>
#include <versionbits.h>
#include <spentindex.h>
#include <algorithm>
#include <exception>
#include <map>
#include <memory>
#include <set>
#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
#include <atomic>
+ Include dependency graph for validation.h:

Go to the source code of this file.

Classes

struct  BlockHasher
 
class  CScriptCheck
 Closure representing one script verification Note that this stores references to the spending transaction. More...
 
class  CVerifyDB
 RAII wrapper for VerifyDB: Verify consistency of the block and coin databases. More...
 

Typedefs

typedef std::unordered_map< uint256, CBlockIndex *, BlockHasherBlockMap
 
typedef std::unordered_multimap< uint256, CBlockIndex *, BlockHasherPrevBlockMap
 

Functions

bool ProcessNewBlock (const CChainParams &chainparams, const std::shared_ptr< const CBlock > pblock, bool fForceProcessing, bool *fNewBlock)
 Process an incoming block. More...
 
bool ProcessNewBlockHeaders (const std::vector< CBlockHeader > &block, CValidationState &state, const CChainParams &chainparams, const CBlockIndex **ppindex=nullptr, CBlockHeader *first_invalid=nullptr)
 Process incoming block headers. More...
 
bool CheckDiskSpace (uint64_t nAdditionalBytes=0)
 Check whether enough disk space is available for an incoming block. More...
 
FILE * OpenBlockFile (const CDiskBlockPos &pos, bool fReadOnly=false)
 Open a block file (blk?????.dat) More...
 
fs::path GetBlockPosFilename (const CDiskBlockPos &pos, const char *prefix)
 Translation to a filesystem path. More...
 
bool LoadExternalBlockFile (const CChainParams &chainparams, FILE *fileIn, CDiskBlockPos *dbp=nullptr)
 Import blocks from an external file. More...
 
bool LoadGenesisBlock (const CChainParams &chainparams)
 Ensures we have a genesis block in the block tree, possibly writing one to disk. More...
 
bool LoadBlockIndex (const CChainParams &chainparams)
 Load the block tree and coins database from disk, initializing state if we're running with -reindex. More...
 
bool LoadChainTip (const CChainParams &chainparams)
 Update the chain tip based on database information. More...
 
void UnloadBlockIndex ()
 Unload database information. More...
 
void ThreadScriptCheck ()
 Run an instance of the script checking thread. More...
 
bool IsInitialBlockDownload ()
 Check whether we are doing an initial block download (synchronizing from disk or network) More...
 
bool GetTransaction (const uint256 &hash, CTransactionRef &tx, const Consensus::Params &params, uint256 &hashBlock, bool fAllowSlow=false, CBlockIndex *blockIndex=nullptr)
 Retrieve a transaction (from memory pool, or from disk, if possible) More...
 
bool ActivateBestChain (CValidationState &state, const CChainParams &chainparams, std::shared_ptr< const CBlock > pblock=std::shared_ptr< const CBlock >())
 Find the best known block, and make it the tip of the block chain. More...
 
double ConvertBitsToDouble (unsigned int nBits)
 
CAmount GetBlockSubsidy (int nBits, int nHeight, const Consensus::Params &consensusParams, bool fSuperblockPartOnly=false)
 
CAmount GetMasternodePayment (int nHeight, CAmount blockValue, int nReallocActivationHeight=std::numeric_limits< int >::max())
 
double GuessVerificationProgress (const ChainTxData &data, const CBlockIndex *pindex)
 Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). More...
 
uint64_t CalculateCurrentUsage ()
 Calculate the amount of disk space the block & undo files currently use. More...
 
void PruneOneBlockFile (const int fileNumber)
 Mark one block file as pruned. More...
 
void UnlinkPrunedFiles (const std::set< int > &setFilesToPrune)
 Actually unlink the specified files. More...
 
void FlushStateToDisk ()
 Flush all state, indexes and buffers to disk. More...
 
void PruneAndFlush ()
 Prune block files and flush state to disk. More...
 
void PruneBlockFilesManual (int nManualPruneHeight)
 Prune block files up to a given height. More...
 
bool AcceptToMemoryPool (CTxMemPool &pool, CValidationState &state, const CTransactionRef &tx, bool *pfMissingInputs, bool bypass_limits, const CAmount nAbsurdFee, bool fDryRun=false)
 (try to) add transaction to memory pool More...
 
static bool AcceptToMemoryPoolWithTime (const CChainParams &chainparams, CTxMemPool &pool, CValidationState &state, const CTransactionRef &tx, bool *pfMissingInputs, int64_t nAcceptTime, bool bypass_limits, const CAmount nAbsurdFee, bool fDryRun=false)
 
bool GetUTXOCoin (const COutPoint &outpoint, Coin &coin)
 
int GetUTXOHeight (const COutPoint &outpoint)
 
int GetUTXOConfirmations (const COutPoint &outpoint)
 
std::string FormatStateMessage (const CValidationState &state)
 Convert CValidationState to a human-readable message for logging. More...
 
ThresholdState VersionBitsTipState (const Consensus::Params &params, Consensus::DeploymentPos pos)
 Get the BIP9 state for a given deployment at the current tip. More...
 
BIP9Stats VersionBitsTipStatistics (const Consensus::Params &params, Consensus::DeploymentPos pos)
 Get the numerical statistics for the BIP9 state for a given deployment at the current tip. More...
 
int VersionBitsTipStateSinceHeight (const Consensus::Params &params, Consensus::DeploymentPos pos)
 Get the block height at which the BIP9 deployment switched into the state for the block building on the current tip. More...
 
void UpdateCoins (const CTransaction &tx, CCoinsViewCache &inputs, int nHeight)
 Apply the effects of this transaction on the UTXO set represented by view. More...
 
bool CheckFinalTx (const CTransaction &tx, int flags=-1)
 Transaction validation functions. More...
 
bool TestLockPointValidity (const LockPoints *lp)
 Test whether the LockPoints height and time are still valid on the current chain. More...
 
bool CheckSequenceLocks (const CTransaction &tx, int flags, LockPoints *lp=nullptr, bool useExistingLockPoints=false)
 Check if transaction will be BIP 68 final in the next block to be created. More...
 
bool GetTimestampIndex (const unsigned int &high, const unsigned int &low, std::vector< uint256 > &hashes)
 
bool GetSpentIndex (CSpentIndexKey &key, CSpentIndexValue &value)
 
bool GetAddressIndex (uint160 addressHash, int type, std::vector< std::pair< CAddressIndexKey, CAmount > > &addressIndex, int start=0, int end=0)
 
bool GetAddressUnspent (uint160 addressHash, int type, std::vector< std::pair< CAddressUnspentKey, CAddressUnspentValue > > &unspentOutputs)
 
void InitScriptExecutionCache ()
 Initializes the script-execution cache. More...
 
bool ReadBlockFromDisk (CBlock &block, const CDiskBlockPos &pos, const Consensus::Params &consensusParams)
 Functions for disk access for blocks. More...
 
bool ReadBlockFromDisk (CBlock &block, const CBlockIndex *pindex, const Consensus::Params &consensusParams)
 
bool CheckBlock (const CBlock &block, CValidationState &state, const Consensus::Params &consensusParams, bool fCheckPOW=true, bool fCheckMerkleRoot=true)
 Functions for validating blocks and updating the block tree. More...
 
bool TestBlockValidity (CValidationState &state, const CChainParams &chainparams, const CBlock &block, CBlockIndex *pindexPrev, bool fCheckPOW=true, bool fCheckMerkleRoot=true)
 Check a block is completely valid from start to finish (only works on top of our current best block, with cs_main held) More...
 
bool ReplayBlocks (const CChainParams &params, CCoinsView *view)
 Replay blocks that aren't fully applied to the database. More...
 
CBlockIndexFindForkInGlobalIndex (const CChain &chain, const CBlockLocator &locator)
 Find the last common block between the parameter chain and a locator. More...
 
bool PreciousBlock (CValidationState &state, const CChainParams &params, CBlockIndex *pindex)
 Mark a block as precious and reorganize. More...
 
bool InvalidateBlock (CValidationState &state, const CChainParams &chainparams, CBlockIndex *pindex)
 Mark a block as invalid. More...
 
bool ResetBlockFailureFlags (CBlockIndex *pindex)
 Remove invalidity status from a block and its descendants. More...
 
int GetSpendHeight (const CCoinsViewCache &inputs)
 Return the spend height, which is one more than the inputs.GetBestBlock(). More...
 
int32_t ComputeBlockVersion (const CBlockIndex *pindexPrev, const Consensus::Params &params, bool fCheckMasternodesUpgraded=false)
 Determine what nVersion a new block should use. More...
 
bool GetBlockHash (uint256 &hashRet, int nBlockHeight=-1)
 Return true if hash can be found in chainActive at nBlockHeight height. More...
 
CBlockFileInfoGetBlockFileInfo (size_t n)
 Get block file info entry for one block file. More...
 
bool DumpMempool ()
 Dump the mempool to disk. More...
 
bool LoadMempool ()
 Load the mempool from disk. More...
 

Variables

static const bool DEFAULT_WHITELISTRELAY = true
 Default for -whitelistrelay. More...
 
static const bool DEFAULT_WHITELISTFORCERELAY = true
 Default for -whitelistforcerelay. More...
 
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000
 Default for -minrelaytxfee, minimum relay fee for transactions. More...
 
static const CAmount DEFAULT_TRANSACTION_MAXFEE = 0.1 * COIN
 -maxtxfee default More...
 
static const CAmount HIGH_TX_FEE_PER_KB = 0.01 * COIN
 Discourage users to set fees higher than this amount (in duffs) per kB. More...
 
static const CAmount HIGH_MAX_TX_FEE = 100 * HIGH_TX_FEE_PER_KB
 -maxtxfee will warn if called with a higher fee than this amount (in duffs) More...
 
static const unsigned int DEFAULT_ANCESTOR_LIMIT = 25
 Default for -limitancestorcount, max number of in-mempool ancestors. More...
 
static const unsigned int DEFAULT_ANCESTOR_SIZE_LIMIT = 101
 Default for -limitancestorsize, maximum kilobytes of tx + all in-mempool ancestors. More...
 
static const unsigned int DEFAULT_DESCENDANT_LIMIT = 25
 Default for -limitdescendantcount, max number of in-mempool descendants. More...
 
static const unsigned int DEFAULT_DESCENDANT_SIZE_LIMIT = 101
 Default for -limitdescendantsize, maximum kilobytes of in-mempool descendants. More...
 
static const unsigned int DEFAULT_MEMPOOL_EXPIRY = 336
 Default for -mempoolexpiry, expiration time for mempool transactions in hours. More...
 
static const unsigned int MAX_DISCONNECTED_TX_POOL_SIZE = 20000
 Maximum kilobytes for transactions to store for processing during reorg. More...
 
static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000
 The maximum size of a blk?????.dat file (since 0.8) More...
 
static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000
 The pre-allocation chunk size for blk?????.dat files (since 0.8) More...
 
static const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000
 The pre-allocation chunk size for rev?????.dat files (since 0.8) More...
 
static const int MAX_SCRIPTCHECK_THREADS = 16
 Maximum number of script-checking threads allowed. More...
 
static const int DEFAULT_SCRIPTCHECK_THREADS = 0
 -par default (number of script-checking threads, 0 = auto) More...
 
static const int MAX_BLOCKS_IN_TRANSIT_PER_PEER = 16
 Number of blocks that can be requested at any given time from a single peer. More...
 
static const unsigned int BLOCK_STALLING_TIMEOUT = 2
 Timeout in seconds during which a peer must stall block download progress before being disconnected. More...
 
static const unsigned int MAX_HEADERS_RESULTS = 2000
 Number of headers sent in one getheaders result. More...
 
static const int MAX_CMPCTBLOCK_DEPTH = 5
 Maximum depth of blocks we're willing to serve as compact blocks to peers when requested. More...
 
static const int MAX_BLOCKTXN_DEPTH = 10
 Maximum depth of blocks we're willing to respond to GETBLOCKTXN requests for. More...
 
static const unsigned int BLOCK_DOWNLOAD_WINDOW = 1024
 Size of the "block download window": how far ahead of our current height do we fetch? Larger windows tolerate larger download speed differences between peer, but increase the potential degree of disordering of blocks on disk (which make reindexing and pruning harder). More...
 
static const unsigned int DATABASE_WRITE_INTERVAL = 60 * 60
 Time to wait (in seconds) between writing blocks/block index to disk. More...
 
static const unsigned int DATABASE_FLUSH_INTERVAL = 24 * 60 * 60
 Time to wait (in seconds) between flushing chainstate to disk. More...
 
static const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111
 Maximum length of reject messages. More...
 
static const int64_t BLOCK_DOWNLOAD_TIMEOUT_BASE = 1000000
 Block download timeout base, expressed in millionths of the block interval (i.e. More...
 
static const int64_t BLOCK_DOWNLOAD_TIMEOUT_PER_PEER = 500000
 Additional block download timeout per parallel downloading peer (i.e. More...
 
static const int64_t DEFAULT_MAX_TIP_AGE = 6 * 60 * 60
 
static const int64_t MAX_FEE_ESTIMATION_TIP_AGE = 3 * 60 * 60
 Maximum age of our tip in seconds for us to be considered current for fee estimation. More...
 
static const bool DEFAULT_PERMIT_BAREMULTISIG = true
 Default for -permitbaremultisig. More...
 
static const unsigned int DEFAULT_BYTES_PER_SIGOP = 20
 
static const bool DEFAULT_CHECKPOINTS_ENABLED = true
 
static const bool DEFAULT_TXINDEX = true
 
static const bool DEFAULT_ADDRESSINDEX = false
 
static const bool DEFAULT_TIMESTAMPINDEX = false
 
static const bool DEFAULT_SPENTINDEX = false
 
static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100
 
static const bool DEFAULT_PERSIST_MEMPOOL = true
 Default for -persistmempool. More...
 
static const bool DEFAULT_SYNC_MEMPOOL = true
 Default for -syncmempool. More...
 
static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8
 Maximum number of headers to announce when relaying blocks with headers message. More...
 
static const int MAX_UNCONNECTING_HEADERS = 10
 Maximum number of unconnecting headers announcements before DoS score. More...
 
static const bool DEFAULT_PEERBLOOMFILTERS = true
 
static const int DEFAULT_STOPATHEIGHT = 0
 Default for -stopatheight. More...
 
CScript COINBASE_FLAGS
 Constant stuff for coinbase transactions we create: More...
 
CCriticalSection cs_main
 
CBlockPolicyEstimator feeEstimator
 
CTxMemPool mempool
 
BlockMapmapBlockIndex
 
PrevBlockMapmapPrevBlockIndex
 
uint64_t nLastBlockTx
 
uint64_t nLastBlockSize
 
const std::string strMessageMagic
 
CWaitableCriticalSection g_best_block_mutex
 
CConditionVariable g_best_block_cv
 
uint256 g_best_block
 
std::atomic_bool fImporting
 
std::atomic_bool fReindex
 
int nScriptCheckThreads
 
bool fTxIndex
 
bool fAddressIndex
 
bool fTimestampIndex
 
bool fSpentIndex
 
bool fIsBareMultisigStd
 
bool fRequireStandard
 
unsigned int nBytesPerSigOp
 
bool fCheckBlockIndex
 
bool fCheckpointsEnabled
 
size_t nCoinCacheUsage
 
CFeeRate minRelayTxFee
 A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) More...
 
CAmount maxTxFee
 Absolute maximum transaction fee (in duffs) used by wallet and mempool (rejects high fee in sendrawtransaction) More...
 
int64_t nMaxTipAge
 If the tip is older than this (in seconds), the node is considered to be in initial block download. More...
 
bool fLargeWorkForkFound
 
bool fLargeWorkInvalidChainFound
 
std::atomic< bool > fDIP0001ActiveAtTip
 
uint256 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...
 
static const uint64_t nMinDiskSpace = 52428800
 Minimum disk space required - used in CheckDiskSpace() More...
 
bool fHavePruned
 Pruning-related variables and constants. More...
 
bool fPruneMode
 True if we're running in -prune mode. More...
 
uint64_t nPruneTarget
 Number of MiB of block files that we're trying to stay below. More...
 
static const unsigned int MIN_BLOCKS_TO_KEEP = 288
 Block files containing a block-height within MIN_BLOCKS_TO_KEEP of chainActive.Tip() will not be pruned. More...
 
static const unsigned int NODE_NETWORK_LIMITED_MIN_BLOCKS = 288
 Minimum blocks required to signal NODE_NETWORK_LIMITED. 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 = 945 * 1024 * 1024
 
CChainchainActive
 The currently-connected chain of blocks (protected by cs_main). More...
 
std::unique_ptr< CCoinsViewDBpcoinsdbview
 Global variable that points to the coins database (protected by cs_main) 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
 
static const unsigned int REJECT_INTERNAL = 0x100
 Reject codes greater or equal to this can be returned by AcceptToMemPool for transactions, to signal internal conditions. More...
 
static const unsigned int REJECT_HIGHFEE = 0x100
 Too high fee. More...
 

Typedef Documentation

◆ BlockMap

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

Definition at line 152 of file validation.h.

◆ PrevBlockMap

typedef std::unordered_multimap<uint256, CBlockIndex*, BlockHasher> PrevBlockMap

Definition at line 153 of file validation.h.

Function Documentation

◆ AcceptToMemoryPool()

bool AcceptToMemoryPool ( CTxMemPool pool,
CValidationState state,
const CTransactionRef tx,
bool *  pfMissingInputs,
bool  bypass_limits,
const CAmount  nAbsurdFee,
bool  fDryRun = false 
)

◆ AcceptToMemoryPoolWithTime()

static bool AcceptToMemoryPoolWithTime ( const CChainParams chainparams,
CTxMemPool pool,
CValidationState state,
const CTransactionRef tx,
bool *  pfMissingInputs,
int64_t  nAcceptTime,
bool  bypass_limits,
const CAmount  nAbsurdFee,
bool  fDryRun = false 
)
static

◆ ActivateBestChain()

bool ActivateBestChain ( CValidationState state,
const CChainParams chainparams,
std::shared_ptr< const CBlock pblock = std::shared_ptr< const CBlock >() 
)

◆ CalculateCurrentUsage()

uint64_t CalculateCurrentUsage ( )

Calculate the amount of disk space the block & undo files currently use.

Calculate the amount of disk space the block & undo files currently use.

Definition at line 3874 of file validation.cpp.

References LOCK.

Referenced by FindFilesToPrune(), and getblockchaininfo().

◆ CheckBlock()

◆ CheckDiskSpace()

bool CheckDiskSpace ( uint64_t  nAdditionalBytes = 0)

Check whether enough disk space is available for an incoming block.

Definition at line 4022 of file validation.cpp.

References _(), GetDataDir(), and nMinDiskSpace.

Referenced by AppInitMain(), FindBlockPos(), FindUndoPos(), FlushStateToDisk(), CPrivateSendClientManager::ProcessMessage(), and CPrivateSendClientSession::SendDenominate().

◆ CheckFinalTx()

bool CheckFinalTx ( const CTransaction tx,
int  flags = -1 
)

◆ CheckSequenceLocks()

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

Check if transaction will be BIP 68 final in the next block to be created.

Simulates calling SequenceLocks() with data from the tip of the current active chain. 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 367 of file validation.cpp.

References AssertLockHeld(), CalculateSequenceLocks(), chainActive, CTxMemPool::cs, cs_main, error(), EvaluateSequenceLocks(), flags, CBlockIndex::GetAncestor(), LockPoints::height, LockPoints::maxInputBlock, mempool, MEMPOOL_HEIGHT, Coin::nHeight, CBlockIndex::nHeight, pcoinsTip, CBlockIndex::pprev, CTxIn::prevout, LockPoints::time, CChain::Tip(), and CTransaction::vin.

Referenced by AcceptToMemoryPoolWorker(), and CTxMemPool::removeForReorg().

◆ ComputeBlockVersion()

int32_t ComputeBlockVersion ( const CBlockIndex pindexPrev,
const Consensus::Params params,
bool  fCheckMasternodesUpgraded = false 
)

◆ ConvertBitsToDouble()

double ConvertBitsToDouble ( unsigned int  nBits)

Definition at line 1083 of file validation.cpp.

Referenced by ContextualCheckBlockHeader(), and GetBlockSubsidy().

◆ DumpMempool()

◆ FindForkInGlobalIndex()

CBlockIndex* FindForkInGlobalIndex ( const CChain chain,
const CBlockLocator locator 
)

Find the last common block between the parameter chain and a locator.

Definition at line 284 of file validation.cpp.

References CChain::Contains(), CChain::Genesis(), mapBlockIndex, and CBlockLocator::vHave.

Referenced by CWallet::CreateWalletFromFile(), and ProcessMessage().

◆ FlushStateToDisk()

void FlushStateToDisk ( )

Flush all state, indexes and buffers to disk.

Definition at line 2526 of file validation.cpp.

References FLUSH_STATE_ALWAYS, FlushStateToDisk(), and Params().

◆ FormatStateMessage()

◆ GetAddressIndex()

bool GetAddressIndex ( uint160  addressHash,
int  type,
std::vector< std::pair< CAddressIndexKey, CAmount > > &  addressIndex,
int  start = 0,
int  end = 0 
)

Definition at line 922 of file validation.cpp.

References error(), fAddressIndex, and pblocktree.

Referenced by getaddressbalance(), getaddressdeltas(), and getaddresstxids().

◆ GetAddressUnspent()

bool GetAddressUnspent ( uint160  addressHash,
int  type,
std::vector< std::pair< CAddressUnspentKey, CAddressUnspentValue > > &  unspentOutputs 
)

Definition at line 934 of file validation.cpp.

References error(), fAddressIndex, and pblocktree.

Referenced by getaddressutxos().

◆ GetBlockFileInfo()

CBlockFileInfo* GetBlockFileInfo ( size_t  n)

Get block file info entry for one block file.

Definition at line 4882 of file validation.cpp.

References LOCK.

Referenced by BOOST_FIXTURE_TEST_CASE().

◆ GetBlockHash()

bool GetBlockHash ( uint256 hashRet,
int  nBlockHeight = -1 
)

Return true if hash can be found in chainActive at nBlockHeight height.

Fills hashRet with found hash, if no nBlockHeight is specified - chainActive.Height() is used.

Definition at line 1894 of file validation.cpp.

References chainActive, cs_main, CChain::Height(), LOCK, and CChain::Tip().

Referenced by llmq::CQuorumBlockProcessor::GetQuorumBlockHash(), ProcessMessage(), and CDeterministicMNManager::UpgradeDBIfNeeded().

◆ GetBlockPosFilename()

fs::path GetBlockPosFilename ( const CDiskBlockPos pos,
const char *  prefix 
)

Translation to a filesystem path.

Definition at line 4065 of file validation.cpp.

References GetDataDir(), CDiskBlockPos::nFile, prefix, and strprintf.

Referenced by OpenDiskFile(), ThreadImport(), and UnlinkPrunedFiles().

◆ GetBlockSubsidy()

◆ GetMasternodePayment()

CAmount GetMasternodePayment ( int  nHeight,
CAmount  blockValue,
int  nReallocActivationHeight = std::numeric_limits< int >::max() 
)

◆ GetSpendHeight()

int GetSpendHeight ( const CCoinsViewCache inputs)

Return the spend height, which is one more than the inputs.GetBestBlock().

While checking, GetBestBlock() refers to the parent block. (protected by cs_main) This is also true for mempool checks.

Definition at line 1398 of file validation.cpp.

References cs_main, CCoinsViewCache::GetBestBlock(), LOCK, mapBlockIndex, and CBlockIndex::nHeight.

Referenced by AcceptToMemoryPoolWorker(), and CTxMemPool::check().

◆ GetSpentIndex()

bool GetSpentIndex ( CSpentIndexKey key,
CSpentIndexValue value 
)

Definition at line 908 of file validation.cpp.

References fSpentIndex, CTxMemPool::getSpentIndex(), mempool, and pblocktree.

Referenced by getspentinfo(), and TxToJSON().

◆ GetTimestampIndex()

bool GetTimestampIndex ( const unsigned int &  high,
const unsigned int &  low,
std::vector< uint256 > &  hashes 
)

Definition at line 897 of file validation.cpp.

References error(), fTimestampIndex, high, low, and pblocktree.

Referenced by getblockhashes().

◆ GetTransaction()

◆ GetUTXOCoin()

◆ GetUTXOConfirmations()

int GetUTXOConfirmations ( const COutPoint outpoint)

Definition at line 456 of file validation.cpp.

References chainActive, cs_main, GetUTXOHeight(), CChain::Height(), LOCK, and CChain::Tip().

Referenced by BuildDMNListEntry().

◆ GetUTXOHeight()

int GetUTXOHeight ( const COutPoint outpoint)

Definition at line 449 of file validation.cpp.

References GetUTXOCoin(), and Coin::nHeight.

Referenced by GetUTXOConfirmations().

◆ 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 5035 of file validation.cpp.

References ChainTxData::dTxRate, CBlockIndex::GetBlockTime(), CBlockIndex::nChainTx, ChainTxData::nTime, and ChainTxData::nTxCount.

Referenced by getblockchaininfo(), ClientModel::getVerificationProgress(), LoadChainTip(), CWallet::ScanForWalletTransactions(), and UpdateTip().

◆ InitScriptExecutionCache()

void InitScriptExecutionCache ( )

Initializes the script-execution cache.

Definition at line 1409 of file validation.cpp.

References DEFAULT_MAX_SIG_CACHE_SIZE, gArgs, ArgsManager::GetArg(), LogPrintf, MAX_MAX_SIG_CACHE_SIZE, and scriptExecutionCache.

Referenced by AppInitMain().

◆ InvalidateBlock()

bool InvalidateBlock ( CValidationState state,
const CChainParams chainparams,
CBlockIndex pindex 
)

◆ IsInitialBlockDownload()

◆ LoadBlockIndex()

bool LoadBlockIndex ( const CChainParams chainparams)

Load the block tree and coins database from disk, initializing state if we're running with -reindex.

Definition at line 4490 of file validation.cpp.

References DEFAULT_ADDRESSINDEX, DEFAULT_SPENTINDEX, DEFAULT_TIMESTAMPINDEX, DEFAULT_TXINDEX, fAddressIndex, fReindex(), fSpentIndex, fTimestampIndex, fTxIndex, gArgs, ArgsManager::GetBoolArg(), LoadBlockIndexDB(), LogPrintf, mapBlockIndex, and pblocktree.

Referenced by AppInitMain().

◆ LoadChainTip()

◆ LoadExternalBlockFile()

◆ LoadGenesisBlock()

bool LoadGenesisBlock ( const CChainParams chainparams)

Ensures we have a genesis block in the block tree, possibly writing one to disk.

Definition at line 4571 of file validation.cpp.

References g_chainstate, and CChainState::LoadGenesisBlock().

Referenced by AppInitMain(), and ThreadImport().

◆ LoadMempool()

◆ OpenBlockFile()

FILE* OpenBlockFile ( const CDiskBlockPos pos,
bool  fReadOnly = false 
)

Open a block file (blk?????.dat)

Definition at line 4056 of file validation.cpp.

References OpenDiskFile().

Referenced by FindBlockPos(), FlushBlockFile(), GetTransaction(), LoadBlockIndexDB(), ReadBlockFromDisk(), ThreadImport(), and WriteBlockToDisk().

◆ PreciousBlock()

bool PreciousBlock ( CValidationState state,
const CChainParams params,
CBlockIndex pindex 
)

Mark a block as precious and reorganize.

Definition at line 3104 of file validation.cpp.

References g_chainstate, and CChainState::PreciousBlock().

Referenced by preciousblock().

◆ ProcessNewBlock()

bool ProcessNewBlock ( const CChainParams chainparams,
const std::shared_ptr< const CBlock pblock,
bool  fForceProcessing,
bool *  fNewBlock 
)

Process an incoming block.

This only returns after the best known valid block is made active. Note that it does not, however, guarantee that the specific block passed to it has been checked for validity!

If you want to possibly get feedback on whether pblock is valid, you must install a CValidationInterface (see validationinterface.h) - this will have its BlockChecked method called whenever any block completes validation.

Note that we guarantee that either the proof-of-work is valid on pblock, or (and possibly also) BlockChecked will have been called.

Call without cs_main held.

Parameters
[in]pblockThe block we want to process.
[in]fForceProcessingProcess this block even if unrequested; used for non-network block sources and whitelisted peers.
[out]fNewBlockA boolean which is set to indicate if the block was first received via this call
Returns
True if state.IsValid()

Definition at line 3803 of file validation.cpp.

References CChainState::AcceptBlock(), CChainState::ActivateBestChain(), AssertLockNotHeld, CMainSignals::BlockChecked(), CheckBlock(), cs_main, error(), FormatStateMessage(), g_chainstate, CChainParams::GetConsensus(), GetMainSignals(), LOCK, LogPrintf, and NotifyHeaderTip().

Referenced by ProcessMessage(), and submitblock().

◆ ProcessNewBlockHeaders()

bool ProcessNewBlockHeaders ( const std::vector< CBlockHeader > &  block,
CValidationState state,
const CChainParams chainparams,
const CBlockIndex **  ppindex = nullptr,
CBlockHeader first_invalid = nullptr 
)

Process incoming block headers.

Call without cs_main held.

Parameters
[in]blockThe block headers themselves
[out]stateThis may be set to an Error state if any error occurred processing them
[in]chainparamsThe params for the chain we want to connect to
[out]ppindexIf set, the pointer will be set to point to the last new block index object for the given headers
[out]first_invalidFirst header that fails validation, if one exists

Definition at line 3682 of file validation.cpp.

References CChainState::AcceptBlockHeader(), cs_main, g_chainstate, LOCK, NotifyHeaderTip(), and CBlockHeader::SetNull().

Referenced by ProcessHeadersMessage(), and ProcessMessage().

◆ PruneAndFlush()

void PruneAndFlush ( )

Prune block files and flush state to disk.

Definition at line 2532 of file validation.cpp.

References FLUSH_STATE_NONE, FlushStateToDisk(), and Params().

Referenced by AppInitMain().

◆ PruneBlockFilesManual()

void PruneBlockFilesManual ( int  nManualPruneHeight)

Prune block files up to a given height.

Definition at line 3953 of file validation.cpp.

References FLUSH_STATE_NONE, FlushStateToDisk(), and Params().

Referenced by pruneblockchain().

◆ PruneOneBlockFile()

void PruneOneBlockFile ( const int  fileNumber)

◆ ReadBlockFromDisk() [1/2]

◆ ReadBlockFromDisk() [2/2]

bool ReadBlockFromDisk ( CBlock block,
const CBlockIndex pindex,
const Consensus::Params consensusParams 
)

◆ ReplayBlocks()

bool ReplayBlocks ( const CChainParams params,
CCoinsView view 
)

Replay blocks that aren't fully applied to the database.

Definition at line 4451 of file validation.cpp.

References g_chainstate, and CChainState::ReplayBlocks().

Referenced by AppInitMain().

◆ ResetBlockFailureFlags()

bool ResetBlockFailureFlags ( CBlockIndex pindex)

Remove invalidity status from a block and its descendants.

Definition at line 3218 of file validation.cpp.

References g_chainstate, and CChainState::ResetBlockFailureFlags().

Referenced by llmq::CChainLocksHandler::EnforceBestChainLock(), and reconsiderblock().

◆ TestBlockValidity()

bool TestBlockValidity ( CValidationState state,
const CChainParams chainparams,
const CBlock block,
CBlockIndex pindexPrev,
bool  fCheckPOW = true,
bool  fCheckMerkleRoot = true 
)

◆ TestLockPointValidity()

bool TestLockPointValidity ( const LockPoints lp)

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

Definition at line 349 of file validation.cpp.

References AssertLockHeld(), chainActive, CChain::Contains(), cs_main, and LockPoints::maxInputBlock.

Referenced by CTxMemPool::removeForReorg().

◆ ThreadScriptCheck()

void ThreadScriptCheck ( )

Run an instance of the script checking thread.

Definition at line 1866 of file validation.cpp.

References RenameThread(), and scriptcheckqueue.

Referenced by AppInitMain().

◆ UnlinkPrunedFiles()

void UnlinkPrunedFiles ( const std::set< int > &  setFilesToPrune)

Actually unlink the specified files.

Definition at line 3920 of file validation.cpp.

References GetBlockPosFilename(), and LogPrintf.

Referenced by BOOST_FIXTURE_TEST_CASE(), and FlushStateToDisk().

◆ UnloadBlockIndex()

◆ UpdateCoins()

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

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

Definition at line 1386 of file validation.cpp.

References UpdateCoins().

◆ VersionBitsTipState()

ThresholdState VersionBitsTipState ( const Consensus::Params params,
Consensus::DeploymentPos  pos 
)

Get the BIP9 state for a given deployment at the current tip.

Definition at line 4889 of file validation.cpp.

References AssertLockHeld(), chainActive, cs_main, CChain::Tip(), versionbitscache, and VersionBitsState().

Referenced by BIP9SoftForkDesc().

◆ VersionBitsTipStateSinceHeight()

int VersionBitsTipStateSinceHeight ( const Consensus::Params params,
Consensus::DeploymentPos  pos 
)

Get the block height at which the BIP9 deployment switched into the state for the block building on the current tip.

Definition at line 4901 of file validation.cpp.

References chainActive, cs_main, LOCK, CChain::Tip(), versionbitscache, and VersionBitsStateSinceHeight().

Referenced by BIP9SoftForkDesc().

◆ VersionBitsTipStatistics()

BIP9Stats VersionBitsTipStatistics ( const Consensus::Params params,
Consensus::DeploymentPos  pos 
)

Get the numerical statistics for the BIP9 state for a given deployment at the current tip.

Definition at line 4895 of file validation.cpp.

References chainActive, cs_main, LOCK, CChain::Tip(), versionbitscache, and VersionBitsStatistics().

Referenced by BIP9SoftForkDesc().

Variable Documentation

◆ BLOCK_DOWNLOAD_TIMEOUT_BASE

const int64_t BLOCK_DOWNLOAD_TIMEOUT_BASE = 1000000
static

Block download timeout base, expressed in millionths of the block interval (i.e.

2.5 min)

Definition at line 110 of file validation.h.

Referenced by PeerLogicValidation::SendMessages().

◆ BLOCK_DOWNLOAD_TIMEOUT_PER_PEER

const int64_t BLOCK_DOWNLOAD_TIMEOUT_PER_PEER = 500000
static

Additional block download timeout per parallel downloading peer (i.e.

1.25 min)

Definition at line 112 of file validation.h.

Referenced by PeerLogicValidation::SendMessages().

◆ BLOCK_DOWNLOAD_WINDOW

const unsigned int BLOCK_DOWNLOAD_WINDOW = 1024
static

Size of the "block download window": how far ahead of our current height do we fetch? Larger windows tolerate larger download speed differences between peer, but increase the potential degree of disordering of blocks on disk (which make reindexing and pruning harder).

We'll probably want to make this a per-peer adaptive value at some point.

Definition at line 102 of file validation.h.

◆ BLOCK_STALLING_TIMEOUT

const unsigned int BLOCK_STALLING_TIMEOUT = 2
static

Timeout in seconds during which a peer must stall block download progress before being disconnected.

Definition at line 89 of file validation.h.

Referenced by PeerLogicValidation::SendMessages().

◆ BLOCKFILE_CHUNK_SIZE

const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000
static

The pre-allocation chunk size for blk?????.dat files (since 0.8)

Definition at line 78 of file validation.h.

Referenced by FindBlockPos(), and FindFilesToPrune().

◆ chainActive

CChain& chainActive

The currently-connected chain of blocks (protected by cs_main).

Definition at line 217 of file validation.cpp.

Referenced by AcceptToMemoryPoolWorker(), ListCoinsTestingSetup::AddTx(), AlreadyHave(), AppInitMain(), blockheaderToJSON(), BlockRequestAllowed(), blockToJSON(), CWallet::BlockUntilSyncedToCurrentChain(), BOOST_FIXTURE_TEST_CASE(), BuildSimplifiedMNListDiff(), llmq::CChainLocksHandler::CheckActiveState(), llmq::CInstantSendManager::CheckCanLock(), CheckFinalTx(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), CheckSequenceLocks(), llmq::CChainLocksHandler::Cleanup(), PeerLogicValidation::ConsiderEviction(), BlockAssembler::CreateNewBlock(), CWallet::CreateTransaction(), CreateTransactionTestSetup::CreateTransactionTestSetup(), CWallet::CreateWalletFromFile(), dumpwallet(), llmq::CChainLocksHandler::EnforceBestChainLock(), FindFilesToPrune(), FindFilesToPruneManual(), FlushStateToDisk(), TransactionDesc::FormatTxStatus(), getbestblockhash(), getblockchaininfo(), getblockcount(), GetBlockHash(), getblockhash(), getblockheaders(), getblockstats(), getblocktemplate(), CMasternodePayments::GetBlockTxOuts(), getchaintips(), getchaintxstats(), CreateTransactionTestSetup::GetCoins(), CMerkleTx::GetDepthInMainChain(), GetDifficulty(), getgovernanceinfo(), CWallet::GetKeyBirthTimes(), ClientModel::getLastBlockDate(), ClientModel::getLastBlockHash(), getmerkleblocks(), getmininginfo(), GetNetworkHashPS(), ClientModel::getNumBlocks(), getrawtransaction(), GetRequiredPaymentsStrings(), GetTransaction(), gettxoutproof(), GetUTXOConfirmations(), ClientModel::getVerificationProgress(), importelectrumwallet(), importmulti(), importprunedfunds(), importwallet(), CDSNotificationInterface::InitializeCurrentBlockTip(), InvalidChainFound(), CGovernanceObject::IsCollateralValid(), IsCurrentForFeeEstimation(), IsInitialBlockDownload(), ListCoinsTestingSetup::ListCoinsTestingSetup(), listsinceblock(), LoadChainTip(), CWallet::MarkConflicted(), masternode_winners(), masternodelist(), ParseBlock(), WalletModel::pollBalanceChanged(), llmq::CQuorumBlockProcessor::ProcessBlock(), llmq::CQuorumBlockProcessor::ProcessCommitment(), ProcessGetBlockData(), ProcessHeadersMessage(), llmq::CQuorumBlockProcessor::ProcessMessage(), ProcessMessage(), CSporkManager::ProcessSpork(), protx_list(), pruneblockchain(), quorum_dkgstatus(), quorum_list(), quorum_memberof(), llmq::CInstantSendManager::RemoveChainLockConflictingLock(), rescanblockchain(), CWallet::RescanFromTime(), rest_getutxos(), rest_headers(), CWallet::ScanForWalletTransactions(), llmq::CQuorumManager::ScanQuorums(), llmq::CSigningManager::SelectQuorumForSigning(), PeerLogicValidation::SendMessages(), TransactionRecord::statusUpdateNeeded(), TestBlockValidity(), TestLockPointValidity(), ThreadImport(), llmq::CChainLocksHandler::TrySignChainTip(), TxToJSON(), UnloadBlockIndex(), UpdateMempoolForReorg(), TransactionRecord::updateStatus(), llmq::CQuorumBlockProcessor::UpgradeDB(), CDeterministicMNManager::UpgradeDBIfNeeded(), CVerifyDB::VerifyDB(), verifytxoutproof(), VersionBitsTipState(), VersionBitsTipStateSinceHeight(), and VersionBitsTipStatistics().

◆ COINBASE_FLAGS

CScript COINBASE_FLAGS

Constant stuff for coinbase transactions we create:

Definition at line 255 of file validation.cpp.

Referenced by getblocktemplate(), and IncrementExtraNonce().

◆ cs_main

Definition at line 213 of file validation.cpp.

Referenced by WalletModel::abandonTransaction(), CWallet::AbandonTransaction(), abandontransaction(), CChainState::AcceptBlock(), CChainState::AcceptBlockHeader(), llmq::CChainLocksHandler::AcceptedBlockHeader(), AcceptToMemoryPoolWorker(), CChainState::ActivateBestChain(), CChainState::ActivateBestChainStep(), CGovernanceManager::AddGovernanceObject(), addmultisigaddress(), AddTx(), ListCoinsTestingSetup::AddTx(), AppInitMain(), llmq::CInstantSendManager::AskNodesForLockedTx(), CWallet::AutoBackupWallet(), CWallet::AutoLockMasternodeCollaterals(), CWallet::AvailableCoins(), backupwallet(), llmq::CSigSharesManager::BanNode(), PeerLogicValidation::BlockChecked(), PeerLogicValidation::BlockConnected(), CWallet::BlockConnected(), CWallet::BlockDisconnected(), blockheaderToJSON(), BlockRequestAllowed(), blockToJSON(), CWallet::BlockUntilSyncedToCurrentChain(), BOOST_FIXTURE_TEST_CASE(), BuildSimplifiedMNListDiff(), CalculateObjectGetDataTime(), llmq::CChainLocksHandler::CheckActiveState(), CChainState::CheckBlockIndex(), llmq::CInstantSendManager::CheckCanLock(), CheckFinalTx(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), PeerLogicValidation::CheckForStaleTipAndEvictPeers(), CheckInputs(), CheckInputsFromMempoolAndCache(), CGovernanceManager::CheckPostponedObjects(), CheckSequenceLocks(), llmq::CChainLocksHandler::Cleanup(), llmq::CSigSharesManager::CollectPendingSigSharesToVerify(), combinerawtransaction(), CPrivateSendServer::CommitFinalTransaction(), CWallet::CommitTransaction(), ComputeBlockVersion(), CChainState::ConnectBlock(), PeerLogicValidation::ConsiderEviction(), CPrivateSendServer::ConsumeCollateral(), CWallet::CountInputsWithAmount(), CWallet::CreateCollateralTransaction(), CPrivateSendClientSession::CreateDenominated(), BlockAssembler::CreateNewBlock(), CWallet::CreateTransaction(), decoderawtransaction(), TransactionTablePriv::describe(), CPrivateSendClientSession::DoAutomaticDenominating(), llmq::CChainLocksHandler::DoInvalidateBlock(), dumpprivkey(), dumpwallet(), encryptwallet(), llmq::CChainLocksHandler::EnforceBestChainLock(), EraseObjectRequest(), PeerLogicValidation::EvictExtraOutboundPeers(), PeerLogicValidation::FinalizeNode(), FindFilesToPrune(), FindFilesToPruneManual(), FlushStateToDisk(), TransactionDesc::FormatTxStatus(), CWallet::FundTransaction(), getaccount(), getaccountaddress(), getaddressesbyaccount(), CWallet::GetAnonymizedBalance(), CWallet::GetAvailableBalance(), CWallet::GetAverageAnonymizedRounds(), getbalance(), CWallet::GetBalance(), getbestblockhash(), getbestchainlock(), getblock(), getblockchaininfo(), getblockcount(), GetBlockHash(), getblockhash(), getblockheader(), getblockheaders(), GetBlockScriptFlags(), getblockstats(), getblocktemplate(), CMasternodePayments::GetBlockTxOuts(), llmq::CChainLocksHandler::GetBlockTxs(), getchaintips(), getchaintxstats(), CreateTransactionTestSetup::GetCoins(), CWallet::GetCollateralTxDSIn(), llmq::CQuorumBlockProcessor::GetCommitmentsFromBlock(), CWallet::GetDenominatedBalance(), CMerkleTx::GetDepthInMainChain(), getdifficulty(), getgovernanceinfo(), ClientModel::getHeaderTipHeight(), ClientModel::getHeaderTipTime(), CWallet::GetImmatureBalance(), CWallet::GetImmatureWatchOnlyBalance(), ClientModel::getLastBlockDate(), ClientModel::getLastBlockHash(), CWallet::GetLegacyBalance(), getmerkleblocks(), llmq::CQuorumBlockProcessor::GetMinableCommitment(), llmq::CQuorumBlockProcessor::GetMinableCommitmentTx(), getmininginfo(), getnetworkhashps(), getnetworkinfo(), getnewaddress(), GetNodeStateStats(), CWallet::GetNormalizedAnonymizedBalance(), ClientModel::getNumBlocks(), GetObjectRequestTime(), WalletModel::getOutputs(), llmq::CQuorumManager::GetQuorum(), llmq::CQuorumBlockProcessor::GetQuorumBlockHash(), getrawchangeaddress(), getrawtransaction(), getreceivedbyaccount(), getreceivedbyaddress(), GetRequestedObjectCount(), GetRequiredPaymentsStrings(), getspecialtxes(), GetSpendHeight(), GetTransaction(), gettransaction(), TransactionTablePriv::getTxHex(), gettxout(), gettxoutproof(), getunconfirmedbalance(), CWallet::GetUnconfirmedBalance(), CWallet::GetUnconfirmedWatchOnlyBalance(), GetUTXOCoin(), GetUTXOConfirmations(), GetUTXOStats(), ClientModel::getVerificationProgress(), getwalletinfo(), CWallet::GetWatchOnlyBalance(), gobject_get(), gobject_submit(), llmq::CDKGSessionHandler::HandleDKGRound(), importaddress(), importelectrumwallet(), importmulti(), importprivkey(), importprunedfunds(), importpubkey(), importwallet(), TransactionTablePriv::index(), CActiveMasternodeManager::Init(), CDSNotificationInterface::InitializeCurrentBlockTip(), PeerLogicValidation::InitializeNode(), CChainState::InvalidateBlock(), invalidateblock(), CMerkleTx::IsChainLocked(), CGovernanceObject::IsCollateralValid(), CPrivateSend::IsCollateralValid(), IsCurrentForFeeEstimation(), IsInitialBlockDownload(), WalletModel::isLockedCoin(), WalletModel::isSpent(), keypoolrefill(), listaccounts(), listaddressbalances(), listaddressgroupings(), CWallet::ListCoins(), WalletModel::listLockedCoins(), listlockunspent(), ListObjects(), WalletModel::listProTxCoins(), listreceivedbyaccount(), listreceivedbyaddress(), listsinceblock(), listtransactions(), listunspent(), LoadExternalBlockFile(), CChainState::LoadGenesisBlock(), LoadMempool(), WalletBatch::LoadWallet(), CWallet::LoadWallet(), WalletModel::lockCoin(), lockunspent(), CPrivateSendClientSession::MakeCollateralAmounts(), CWallet::MarkConflicted(), masternode_winners(), masternodelist(), movecmd(), PeerLogicValidation::NewPoWValidBlock(), CZMQPublishRawBlockNotifier::NotifyBlock(), CZMQPublishRawChainLockNotifier::NotifyChainLock(), CZMQPublishRawChainLockSigNotifier::NotifyChainLock(), NotifyHeaderTip(), ParseBlock(), WalletModel::pollBalanceChanged(), CChainState::PreciousBlock(), preciousblock(), CPrivateSendClientSession::PrepareDenominate(), PrepareShutdown(), WalletModel::prepareTransaction(), prioritisetransaction(), llmq::CQuorumBlockProcessor::ProcessBlock(), CDeterministicMNManager::ProcessBlock(), ProcessGetBlockData(), ProcessGetData(), ProcessHeadersMessage(), llmq::CInstantSendManager::ProcessInstantSendLock(), llmq::CQuorumBlockProcessor::ProcessMessage(), CMNAuth::ProcessMessage(), llmq::CDKGSessionManager::ProcessMessage(), CPrivateSendServer::ProcessMessage(), CPrivateSendClientManager::ProcessMessage(), CGovernanceManager::ProcessMessage(), ProcessMessage(), llmq::CInstantSendManager::ProcessMessageInstantSendLock(), llmq::CSigningManager::ProcessMessageRecoveredSig(), PeerLogicValidation::ProcessMessages(), ProcessNewBlock(), ProcessNewBlockHeaders(), llmq::CChainLocksHandler::ProcessNewChainLock(), llmq::CInstantSendManager::ProcessPendingInstantSendLocks(), llmq::ProcessPendingMessageBatch(), llmq::CSigningManager::ProcessPendingRecoveredSigs(), llmq::CSigningManager::ProcessRecoveredSig(), CSporkManager::ProcessSpork(), protx_diff(), protx_list(), pruneblockchain(), llmq::CDKGPendingMessages::PushPendingMessage(), quorum_dkgstatus(), quorum_info(), quorum_list(), quorum_memberof(), CWallet::ReacceptWalletTransactions(), ReadBlockFromDisk(), reconsiderblock(), PeerTablePriv::refreshPeers(), TransactionTablePriv::refreshWallet(), llmq::CSigSharesManager::RemoveBannedNodeStates(), llmq::CInstantSendManager::RemoveChainLockConflictingLock(), removeprunedfunds(), CChainState::ReplayBlocks(), CGovernanceManager::RequestGovernanceObjectVotes(), RequestObject(), rescanblockchain(), CWallet::RescanFromTime(), resendwallettransactions(), CChainState::ResetBlockFailureFlags(), llmq::CInstantSendManager::ResolveBlockConflicts(), rest_block(), rest_getutxos(), rest_headers(), CWallet::ScanForWalletTransactions(), llmq::CQuorumManager::ScanQuorums(), CWallet::SelectCoinsGroupedByAddresses(), llmq::CSigningManager::SelectQuorumForSigning(), SendBlockTransactions(), WalletModel::sendCoins(), sendfrom(), sendmany(), PeerLogicValidation::SendMessages(), sendrawtransaction(), SendRejectsAndCheckIfBanned(), sendtoaddress(), setaccount(), setmocktime(), settxfee(), signmessage(), signrawtransaction(), TransactionRecord::statusUpdateNeeded(), submitblock(), CPrivateSendClientSession::SubmitDenominate(), CGovernanceManager::SyncObjects(), CGovernanceManager::SyncSingleObjVotes(), SyncWithValidationInterfaceQueue(), TestBlockValidity(), TestLockPointValidity(), ThreadImport(), TransactionDesc::toHTML(), llmq::CDKGDebugSessionStatus::ToJson(), CWallet::TransactionAddedToMempool(), CWallet::TransactionCanBeAbandoned(), llmq::CChainLocksHandler::TrySignChainTip(), llmq::CQuorumBlockProcessor::UndoBlock(), UnloadBlockIndex(), WalletModel::unlockCoin(), CGovernanceManager::UpdateCachesAndClean(), CActiveMasternodeManager::UpdatedBlockTip(), MasternodeList::updateDIP3List(), UpdateLastBlockAnnounceTime(), CGovernanceObject::UpdateLocalValidity(), UpdateMempoolForReorg(), UpdateObjectRequestTime(), TransactionRecord::updateStatus(), TransactionTablePriv::updateWallet(), llmq::CQuorumBlockProcessor::UpgradeDB(), CDeterministicMNManager::UpgradeDBIfNeeded(), validateaddress(), verifychain(), CVerifyDB::VerifyDB(), verifymessage(), verifytxoutproof(), VersionBitsTipState(), VersionBitsTipStateSinceHeight(), VersionBitsTipStatistics(), walletlock(), walletpassphrase(), walletpassphrasechange(), and WalletTxToJSON().

◆ DATABASE_FLUSH_INTERVAL

const unsigned int DATABASE_FLUSH_INTERVAL = 24 * 60 * 60
static

Time to wait (in seconds) between flushing chainstate to disk.

Definition at line 106 of file validation.h.

Referenced by FlushStateToDisk().

◆ DATABASE_WRITE_INTERVAL

const unsigned int DATABASE_WRITE_INTERVAL = 60 * 60
static

Time to wait (in seconds) between writing blocks/block index to disk.

Definition at line 104 of file validation.h.

Referenced by FlushStateToDisk().

◆ DEFAULT_ADDRESSINDEX

const bool DEFAULT_ADDRESSINDEX = false
static

Definition at line 123 of file validation.h.

Referenced by AppInitMain(), HelpMessage(), InitParameterInteraction(), and LoadBlockIndex().

◆ DEFAULT_ANCESTOR_LIMIT

const unsigned int DEFAULT_ANCESTOR_LIMIT = 25
static

Default for -limitancestorcount, max number of in-mempool ancestors.

Definition at line 64 of file validation.h.

Referenced by AcceptToMemoryPoolWorker(), CWallet::CreateTransaction(), HelpMessage(), and CWallet::SelectCoins().

◆ DEFAULT_ANCESTOR_SIZE_LIMIT

const unsigned int DEFAULT_ANCESTOR_SIZE_LIMIT = 101
static

Default for -limitancestorsize, maximum kilobytes of tx + all in-mempool ancestors.

Definition at line 66 of file validation.h.

Referenced by AcceptToMemoryPoolWorker(), CWallet::CreateTransaction(), and HelpMessage().

◆ DEFAULT_BANSCORE_THRESHOLD

const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100
static

Definition at line 126 of file validation.h.

Referenced by HelpMessage(), and Misbehaving().

◆ DEFAULT_BYTES_PER_SIGOP

const unsigned int DEFAULT_BYTES_PER_SIGOP = 20
static

Definition at line 120 of file validation.h.

Referenced by HelpMessage().

◆ DEFAULT_CHECKBLOCKS

const signed int DEFAULT_CHECKBLOCKS = 6
static

Definition at line 211 of file validation.h.

Referenced by AppInitMain(), HelpMessage(), and verifychain().

◆ DEFAULT_CHECKLEVEL

const unsigned int DEFAULT_CHECKLEVEL = 3
static

Definition at line 212 of file validation.h.

Referenced by AppInitMain(), HelpMessage(), InitParameterInteraction(), and verifychain().

◆ DEFAULT_CHECKPOINTS_ENABLED

const bool DEFAULT_CHECKPOINTS_ENABLED = true
static

Definition at line 121 of file validation.h.

Referenced by AppInitParameterInteraction(), and HelpMessage().

◆ DEFAULT_DESCENDANT_LIMIT

const unsigned int DEFAULT_DESCENDANT_LIMIT = 25
static

Default for -limitdescendantcount, max number of in-mempool descendants.

Definition at line 68 of file validation.h.

Referenced by AcceptToMemoryPoolWorker(), CWallet::CreateTransaction(), HelpMessage(), and CWallet::SelectCoins().

◆ DEFAULT_DESCENDANT_SIZE_LIMIT

const unsigned int DEFAULT_DESCENDANT_SIZE_LIMIT = 101
static

Default for -limitdescendantsize, maximum kilobytes of in-mempool descendants.

Definition at line 70 of file validation.h.

Referenced by AcceptToMemoryPoolWorker(), AppInitParameterInteraction(), CWallet::CreateTransaction(), and HelpMessage().

◆ DEFAULT_MAX_TIP_AGE

const int64_t DEFAULT_MAX_TIP_AGE = 6 * 60 * 60
static

Definition at line 114 of file validation.h.

Referenced by AppInitParameterInteraction(), and HelpMessage().

◆ DEFAULT_MEMPOOL_EXPIRY

const unsigned int DEFAULT_MEMPOOL_EXPIRY = 336
static

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

Definition at line 72 of file validation.h.

Referenced by AcceptToMemoryPoolWorker(), HelpMessage(), LoadMempool(), and UpdateMempoolForReorg().

◆ DEFAULT_MIN_RELAY_TX_FEE

const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000
static

Default for -minrelaytxfee, minimum relay fee for transactions.

Definition at line 56 of file validation.h.

Referenced by BOOST_FIXTURE_TEST_CASE(), and HelpMessage().

◆ DEFAULT_PEERBLOOMFILTERS

const bool DEFAULT_PEERBLOOMFILTERS = true
static

Definition at line 138 of file validation.h.

Referenced by AppInitParameterInteraction(), and HelpMessage().

◆ DEFAULT_PERMIT_BAREMULTISIG

const bool DEFAULT_PERMIT_BAREMULTISIG = true
static

Default for -permitbaremultisig.

Definition at line 119 of file validation.h.

Referenced by AppInitParameterInteraction(), and HelpMessage().

◆ DEFAULT_PERSIST_MEMPOOL

const bool DEFAULT_PERSIST_MEMPOOL = true
static

Default for -persistmempool.

Definition at line 128 of file validation.h.

Referenced by HelpMessage(), PrepareShutdown(), and ThreadImport().

◆ DEFAULT_SCRIPTCHECK_THREADS

const int DEFAULT_SCRIPTCHECK_THREADS = 0
static

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

Definition at line 85 of file validation.h.

Referenced by AppInitParameterInteraction(), HelpMessage(), and OptionsModel::Init().

◆ DEFAULT_SPENTINDEX

const bool DEFAULT_SPENTINDEX = false
static

Definition at line 125 of file validation.h.

Referenced by AppInitMain(), HelpMessage(), InitParameterInteraction(), and LoadBlockIndex().

◆ DEFAULT_STOPATHEIGHT

const int DEFAULT_STOPATHEIGHT = 0
static

Default for -stopatheight.

Definition at line 141 of file validation.h.

Referenced by CChainState::ActivateBestChain(), and HelpMessage().

◆ DEFAULT_SYNC_MEMPOOL

const bool DEFAULT_SYNC_MEMPOOL = true
static

Default for -syncmempool.

Definition at line 130 of file validation.h.

Referenced by HelpMessage(), and CMasternodeSync::ProcessTick().

◆ DEFAULT_TIMESTAMPINDEX

const bool DEFAULT_TIMESTAMPINDEX = false
static

Definition at line 124 of file validation.h.

Referenced by AppInitMain(), HelpMessage(), InitParameterInteraction(), and LoadBlockIndex().

◆ DEFAULT_TRANSACTION_MAXFEE

const CAmount DEFAULT_TRANSACTION_MAXFEE = 0.1 * COIN
static

-maxtxfee default

Definition at line 58 of file validation.h.

Referenced by HelpMessage().

◆ DEFAULT_TXINDEX

const bool DEFAULT_TXINDEX = true
static

◆ DEFAULT_WHITELISTFORCERELAY

const bool DEFAULT_WHITELISTFORCERELAY = true
static

Default for -whitelistforcerelay.

Definition at line 54 of file validation.h.

Referenced by HelpMessage(), InitParameterInteraction(), and ProcessMessage().

◆ DEFAULT_WHITELISTRELAY

const bool DEFAULT_WHITELISTRELAY = true
static

Default for -whitelistrelay.

Definition at line 52 of file validation.h.

Referenced by HelpMessage(), and ProcessMessage().

◆ fAddressIndex

◆ fCheckBlockIndex

bool fCheckBlockIndex

Definition at line 234 of file validation.cpp.

Referenced by AppInitParameterInteraction(), and CChainState::CheckBlockIndex().

◆ fCheckpointsEnabled

bool fCheckpointsEnabled

Definition at line 235 of file validation.cpp.

Referenced by AppInitParameterInteraction(), and ContextualCheckBlockHeader().

◆ fDIP0001ActiveAtTip

◆ feeEstimator

◆ fHavePruned

bool fHavePruned

Pruning-related variables and constants.

True if any block files have ever been pruned.

Definition at line 229 of file validation.cpp.

Referenced by AppInitMain(), CChainState::CheckBlockIndex(), FlushStateToDisk(), GetBlockChecked(), LoadBlockIndexDB(), rest_block(), and UnloadBlockIndex().

◆ fImporting

◆ fIsBareMultisigStd

bool fIsBareMultisigStd

Definition at line 231 of file validation.cpp.

Referenced by AppInitParameterInteraction(), and IsStandardTx().

◆ fLargeWorkForkFound

bool fLargeWorkForkFound

Definition at line 14 of file warnings.cpp.

Referenced by GetfLargeWorkForkFound(), GetWarnings(), and SetfLargeWorkForkFound().

◆ fLargeWorkInvalidChainFound

bool fLargeWorkInvalidChainFound

Definition at line 15 of file warnings.cpp.

Referenced by GetWarnings(), and SetfLargeWorkInvalidChainFound().

◆ fPruneMode

◆ fReindex

◆ fRequireStandard

bool fRequireStandard

Definition at line 232 of file validation.cpp.

Referenced by AcceptToMemoryPoolWorker(), and AppInitParameterInteraction().

◆ fSpentIndex

◆ fTimestampIndex

bool fTimestampIndex

◆ fTxIndex

◆ g_best_block

uint256 g_best_block

Definition at line 221 of file validation.cpp.

Referenced by getblocktemplate(), and UpdateTip().

◆ g_best_block_cv

CConditionVariable g_best_block_cv

Definition at line 220 of file validation.cpp.

Referenced by getblocktemplate(), OnRPCStopped(), and UpdateTip().

◆ g_best_block_mutex

CWaitableCriticalSection g_best_block_mutex

Definition at line 219 of file validation.cpp.

Referenced by getblocktemplate(), and UpdateTip().

◆ hashAssumeValid

uint256 hashAssumeValid

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

Definition at line 243 of file validation.cpp.

Referenced by AppInitParameterInteraction(), and CChainState::ConnectBlock().

◆ HIGH_MAX_TX_FEE

const CAmount HIGH_MAX_TX_FEE = 100 * HIGH_TX_FEE_PER_KB
static

-maxtxfee will warn if called with a higher fee than this amount (in duffs)

Definition at line 62 of file validation.h.

Referenced by WalletInit::ParameterInteraction().

◆ HIGH_TX_FEE_PER_KB

const CAmount HIGH_TX_FEE_PER_KB = 0.01 * COIN
static

Discourage users to set fees higher than this amount (in duffs) per kB.

Definition at line 60 of file validation.h.

Referenced by WalletInit::ParameterInteraction().

◆ mapBlockIndex

BlockMap& mapBlockIndex

Definition at line 215 of file validation.cpp.

Referenced by AddTx(), AlreadyHave(), AppInitMain(), BuildSimplifiedMNListDiff(), llmq::CInstantSendManager::CheckCanLock(), llmq::CheckLLMQCommitment(), llmq::CChainLocksHandler::Cleanup(), CWallet::ComputeTimeSmart(), llmq::CChainLocksHandler::DoInvalidateBlock(), llmq::CChainLocksHandler::EnforceBestChainLock(), FindForkInGlobalIndex(), getbestchainlock(), getblock(), getblockheader(), getblockheaders(), getblockstats(), getblocktemplate(), llmq::CChainLocksHandler::GetBlockTxs(), getchaintips(), getchaintxstats(), CMerkleTx::GetDepthInMainChain(), CWallet::GetKeyBirthTimes(), Checkpoints::GetLastCheckpoint(), getmerkleblocks(), llmq::CQuorumManager::GetQuorum(), getrawtransaction(), getspecialtxes(), GetSpendHeight(), GetTransaction(), gettxout(), gettxoutproof(), GetUTXOStats(), llmq::CDKGSessionHandler::HandleDKGRound(), importprunedfunds(), invalidateblock(), CMerkleTx::IsChainLocked(), CGovernanceObject::IsCollateralValid(), listsinceblock(), LoadBlockIndex(), LoadBlockIndexDB(), LoadChainTip(), LoadExternalBlockFile(), CWallet::MarkConflicted(), preciousblock(), llmq::CQuorumBlockProcessor::ProcessCommitment(), ProcessGetBlockData(), ProcessHeadersMessage(), llmq::CInstantSendManager::ProcessInstantSendLock(), llmq::CQuorumBlockProcessor::ProcessMessage(), ProcessMessage(), llmq::CChainLocksHandler::ProcessNewChainLock(), PruneOneBlockFile(), reconsiderblock(), llmq::CInstantSendManager::ResolveBlockConflicts(), rest_block(), rest_headers(), PeerLogicValidation::SendMessages(), submitblock(), llmq::CDKGDebugSessionStatus::ToJson(), TxToJSON(), UnloadBlockIndex(), TransactionRecord::updateStatus(), llmq::CQuorumBlockProcessor::UpgradeDB(), verifytxoutproof(), WalletTxToJSON(), and CMainCleanup::~CMainCleanup().

◆ mapPrevBlockIndex

PrevBlockMap& mapPrevBlockIndex

Definition at line 216 of file validation.cpp.

Referenced by llmq::CChainLocksHandler::EnforceBestChainLock().

◆ MAX_BLOCKFILE_SIZE

const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000
static

The maximum size of a blk?????.dat file (since 0.8)

Definition at line 76 of file validation.h.

Referenced by BOOST_FIXTURE_TEST_CASE(), and FindBlockPos().

◆ MAX_BLOCKS_IN_TRANSIT_PER_PEER

const int MAX_BLOCKS_IN_TRANSIT_PER_PEER = 16
static

Number of blocks that can be requested at any given time from a single peer.

Definition at line 87 of file validation.h.

Referenced by ProcessHeadersMessage(), ProcessMessage(), and PeerLogicValidation::SendMessages().

◆ MAX_BLOCKS_TO_ANNOUNCE

const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8
static

Maximum number of headers to announce when relaying blocks with headers message.

Definition at line 133 of file validation.h.

Referenced by ProcessHeadersMessage(), PeerLogicValidation::SendMessages(), and PeerLogicValidation::UpdatedBlockTip().

◆ MAX_BLOCKTXN_DEPTH

const int MAX_BLOCKTXN_DEPTH = 10
static

Maximum depth of blocks we're willing to respond to GETBLOCKTXN requests for.

Definition at line 97 of file validation.h.

Referenced by ProcessMessage().

◆ MAX_CMPCTBLOCK_DEPTH

const int MAX_CMPCTBLOCK_DEPTH = 5
static

Maximum depth of blocks we're willing to serve as compact blocks to peers when requested.

For older blocks, a regular BLOCK response will be sent.

Definition at line 95 of file validation.h.

Referenced by ProcessGetBlockData().

◆ MAX_DISCONNECTED_TX_POOL_SIZE

const unsigned int MAX_DISCONNECTED_TX_POOL_SIZE = 20000
static

Maximum kilobytes for transactions to store for processing during reorg.

Definition at line 74 of file validation.h.

Referenced by CChainState::DisconnectTip().

◆ MAX_FEE_ESTIMATION_TIP_AGE

const int64_t MAX_FEE_ESTIMATION_TIP_AGE = 3 * 60 * 60
static

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

Definition at line 116 of file validation.h.

Referenced by IsCurrentForFeeEstimation().

◆ MAX_HEADERS_RESULTS

const unsigned int MAX_HEADERS_RESULTS = 2000
static

Number of headers sent in one getheaders result.

We rely on the assumption that if a peer sends less than this number, we reached its tip. Changing this value is a protocol upgrade.

Definition at line 92 of file validation.h.

Referenced by getblockheaders(), getmerkleblocks(), ProcessHeadersMessage(), and ProcessMessage().

◆ MAX_REJECT_MESSAGE_LENGTH

const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111
static

Maximum length of reject messages.

Definition at line 108 of file validation.h.

Referenced by PeerLogicValidation::BlockChecked(), and ProcessMessage().

◆ MAX_SCRIPTCHECK_THREADS

const int MAX_SCRIPTCHECK_THREADS = 16
static

Maximum number of script-checking threads allowed.

Definition at line 83 of file validation.h.

Referenced by AppInitParameterInteraction(), HelpMessage(), and OptionsDialog::OptionsDialog().

◆ MAX_UNCONNECTING_HEADERS

const int MAX_UNCONNECTING_HEADERS = 10
static

Maximum number of unconnecting headers announcements before DoS score.

Definition at line 136 of file validation.h.

Referenced by ProcessHeadersMessage().

◆ maxTxFee

◆ mempool

CTxMemPool mempool

Referenced by CWalletTx::AcceptToMemoryPool(), CChainState::ActivateBestChain(), CChainState::ActivateBestChainStep(), BlockAssembler::addPackageTxs(), AlreadyHave(), AppInitMain(), AppInitParameterInteraction(), llmq::CInstantSendManager::CheckCanLock(), CheckSequenceLocks(), llmq::CChainLocksHandler::Cleanup(), combinerawtransaction(), CPrivateSendServer::CommitFinalTransaction(), CWallet::CommitTransaction(), CChainState::ConnectTip(), CPrivateSendServer::ConsumeCollateral(), CPrivateSendClientSession::CreateDenominated(), BlockAssembler::CreateNewBlock(), CWallet::CreateTransaction(), CChainState::DisconnectTip(), CPrivateSendClientSession::DoAutomaticDenominating(), DumpMempool(), entryToJSON(), FlushStateToDisk(), CWallet::FundTransaction(), getaddressmempool(), getblocktemplate(), CMerkleTx::GetDepthInMainChain(), getmempoolancestors(), getmempooldescendants(), ClientModel::getMempoolDynamicUsage(), getmempoolentry(), ClientModel::getMempoolSize(), getmininginfo(), GetSpentIndex(), GetTransaction(), gettxout(), CPrivateSend::IsCollateralValid(), CPrivateSendBaseSession::IsValidInOuts(), LoadMempool(), CPrivateSendClientSession::MakeCollateralAmounts(), mempoolInfoToJSON(), mempoolToJSON(), PrepareShutdown(), WalletModel::prepareTransaction(), prioritisetransaction(), ProcessGetData(), ProcessMessage(), CWallet::ReacceptWalletTransactions(), llmq::CInstantSendManager::RemoveMempoolConflictsForLock(), resendwallettransactions(), CWallet::ResendWalletTransactionsBefore(), rest_getutxos(), CWallet::SelectCoinsMinConf(), WalletModel::sendCoins(), sendfrom(), sendmany(), PeerLogicValidation::SendMessages(), sendrawtransaction(), sendtoaddress(), signrawtransaction(), BlockAssembler::SkipMapTxEntry(), CPrivateSendClientSession::SubmitDenominate(), UnloadBlockIndex(), CoinControlDialog::updateLabels(), UpdateMempoolForReorg(), BlockAssembler::UpdatePackagesForAdded(), SendCoinsDialog::updateSmartFeeLabel(), UpdateTip(), llmq::CInstantSendManager::UpdateWalletTransaction(), and while().

◆ 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 chainActive.Tip() will not be pruned.

Definition at line 207 of file validation.h.

Referenced by CChainState::AcceptBlock(), AppInitMain(), FindFilesToPrune(), FindFilesToPruneManual(), ProcessMessage(), and pruneblockchain().

◆ MIN_DISK_SPACE_FOR_BLOCK_FILES

const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 945 * 1024 * 1024
static

Definition at line 222 of file validation.h.

Referenced by AppInitParameterInteraction(), and HelpMessage().

◆ minRelayTxFee

CFeeRate minRelayTxFee

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

Definition at line 246 of file validation.cpp.

Referenced by AcceptToMemoryPoolWorker(), AppInitParameterInteraction(), BOOST_FIXTURE_TEST_CASE(), CWallet::CreateTransaction(), getnetworkinfo(), GetRequiredFee(), mempoolInfoToJSON(), and WalletInit::ParameterInteraction().

◆ nBytesPerSigOp

unsigned int nBytesPerSigOp

Definition at line 233 of file validation.cpp.

Referenced by AcceptToMemoryPoolWorker(), and AppInitParameterInteraction().

◆ nCoinCacheUsage

size_t nCoinCacheUsage

Definition at line 236 of file validation.cpp.

Referenced by AppInitMain(), FlushStateToDisk(), and CVerifyDB::VerifyDB().

◆ nLastBlockSize

uint64_t nLastBlockSize

Definition at line 57 of file miner.cpp.

Referenced by BlockAssembler::CreateNewBlock(), and getmininginfo().

◆ nLastBlockTx

uint64_t nLastBlockTx

Definition at line 56 of file miner.cpp.

Referenced by BlockAssembler::CreateNewBlock(), and getmininginfo().

◆ nMaxTipAge

int64_t nMaxTipAge

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

Definition at line 238 of file validation.cpp.

Referenced by AppInitParameterInteraction(), IsInitialBlockDownload(), ProcessMessage(), and PeerLogicValidation::SendMessages().

◆ nMinDiskSpace

const uint64_t nMinDiskSpace = 52428800
static

Minimum disk space required - used in CheckDiskSpace()

Definition at line 197 of file validation.h.

Referenced by CheckDiskSpace().

◆ nMinimumChainWork

arith_uint256 nMinimumChainWork

Minimum work we will assume exists on some valid chain.

Definition at line 244 of file validation.cpp.

Referenced by CChainState::AcceptBlock(), AppInitParameterInteraction(), CChainState::ConnectBlock(), IsInitialBlockDownload(), and ProcessHeadersMessage().

◆ NODE_NETWORK_LIMITED_MIN_BLOCKS

const unsigned int NODE_NETWORK_LIMITED_MIN_BLOCKS = 288
static

Minimum blocks required to signal NODE_NETWORK_LIMITED.

Definition at line 209 of file validation.h.

Referenced by ProcessGetBlockData().

◆ nPruneTarget

uint64_t nPruneTarget

Number of MiB of block files that we're trying to stay below.

Definition at line 237 of file validation.cpp.

Referenced by AppInitParameterInteraction(), FindFilesToPrune(), and getblockchaininfo().

◆ nScriptCheckThreads

int nScriptCheckThreads

◆ pblocktree

◆ pcoinsdbview

std::unique_ptr<CCoinsViewDB> pcoinsdbview

Global variable that points to the coins database (protected by cs_main)

Definition at line 299 of file validation.cpp.

Referenced by AppInitMain(), gettxoutsetinfo(), and PrepareShutdown().

◆ pcoinsTip

◆ pindexBestHeader

◆ REJECT_HIGHFEE

const unsigned int REJECT_HIGHFEE = 0x100
static

Too high fee.

Can not be triggered by P2P transactions

Definition at line 486 of file validation.h.

Referenced by AcceptToMemoryPoolWorker().

◆ REJECT_INTERNAL

const unsigned int REJECT_INTERNAL = 0x100
static

Reject codes greater or equal to this can be returned by AcceptToMemPool for transactions, to signal internal conditions.

They cannot and should not be sent over the P2P network.

Definition at line 484 of file validation.h.

Referenced by PeerLogicValidation::BlockChecked(), and ProcessMessage().

◆ strMessageMagic

◆ UNDOFILE_CHUNK_SIZE

const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000
static

The pre-allocation chunk size for rev?????.dat files (since 0.8)

Definition at line 80 of file validation.h.

Referenced by FindFilesToPrune(), and FindUndoPos().

◆ versionbitscache

Released under the MIT license