Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

validation.cpp File Reference
#include <validation.h>
#include <arith_uint256.h>
#include <blockencodings.h>
#include <chain.h>
#include <chainparams.h>
#include <checkpoints.h>
#include <checkqueue.h>
#include <consensus/consensus.h>
#include <consensus/merkle.h>
#include <consensus/tx_verify.h>
#include <consensus/validation.h>
#include <cuckoocache.h>
#include <hash.h>
#include <init.h>
#include <policy/fees.h>
#include <policy/policy.h>
#include <pow.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <reverse_iterator.h>
#include <script/script.h>
#include <script/sigcache.h>
#include <script/standard.h>
#include <timedata.h>
#include <tinyformat.h>
#include <txdb.h>
#include <txmempool.h>
#include <ui_interface.h>
#include <undo.h>
#include <util.h>
#include <spork.h>
#include <utilmoneystr.h>
#include <utilstrencodings.h>
#include <validationinterface.h>
#include <warnings.h>
#include <masternode/masternode-payments.h>
#include <evo/specialtx.h>
#include <evo/providertx.h>
#include <evo/deterministicmns.h>
#include <evo/cbtx.h>
#include <llmq/quorums_instantsend.h>
#include <llmq/quorums_chainlocks.h>
#include <future>
#include <sstream>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/thread.hpp>
+ Include dependency graph for validation.cpp:

Go to the source code of this file.

Classes

class  CChainState
 CChainState stores and provides an API to update our local knowledge of the current best chain and header tree. More...
 
class  WarningBitsConditionChecker
 Threshold condition checker that triggers when unknown versionbits are seen on the network. More...
 
struct  PerBlockConnectTrace
 
class  ConnectTrace
 Used to track blocks whose transactions were applied to the UTXO state as a part of a single ActivateBestChainStep call. More...
 
class  CMainCleanup
 

Macros

#define MICRO   0.000001
 
#define MILLI   0.001
 

Enumerations

enum  DisconnectResult { DISCONNECT_OK, DISCONNECT_UNCLEAN, DISCONNECT_FAILED }
 
enum  FlushStateMode { FLUSH_STATE_NONE, FLUSH_STATE_IF_NEEDED, FLUSH_STATE_PERIODIC, FLUSH_STATE_ALWAYS }
 

Functions

std::atomic_bool fImporting (false)
 
std::atomic_bool fReindex (false)
 
static void CheckBlockIndex (const Consensus::Params &consensusParams)
 
CBlockIndexFindForkInGlobalIndex (const CChain &chain, const CBlockLocator &locator)
 Find the last common block between the parameter chain and a locator. More...
 
static bool FlushStateToDisk (const CChainParams &chainparams, CValidationState &state, FlushStateMode mode, int nManualPruneHeight)
 Update the on-disk chain state. More...
 
static void FindFilesToPruneManual (std::set< int > &setFilesToPrune, int nManualPruneHeight)
 
static void FindFilesToPrune (std::set< int > &setFilesToPrune, uint64_t nPruneAfterHeight)
 Prune block and undo files (blk???.dat and undo???.dat) so that the disk space used is less than a user-defined target. More...
 
bool CheckInputs (const CTransaction &tx, CValidationState &state, const CCoinsViewCache &inputs, bool fScriptChecks, unsigned int flags, bool cacheSigStore, bool cacheFullScriptStore, PrecomputedTransactionData &txdata, std::vector< CScriptCheck > *pvChecks)
 Check whether all inputs of this transaction are valid (no double spends, scripts & sigs, amounts) This does not modify the UTXO set. More...
 
static FILE * OpenUndoFile (const CDiskBlockPos &pos, bool fReadOnly)
 Open an undo file (rev?????.dat) More...
 
bool CheckFinalTx (const CTransaction &tx, int flags)
 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, bool useExistingLockPoints)
 Check if transaction will be BIP 68 final in the next block to be created. More...
 
bool GetUTXOCoin (const COutPoint &outpoint, Coin &coin)
 
int GetUTXOHeight (const COutPoint &outpoint)
 
int GetUTXOConfirmations (const COutPoint &outpoint)
 
bool ContextualCheckTransaction (const CTransaction &tx, CValidationState &state, const Consensus::Params &consensusParams, const CBlockIndex *pindexPrev)
 
static unsigned int GetBlockScriptFlags (const CBlockIndex *pindex, const Consensus::Params &chainparams)
 
static void LimitMempoolSize (CTxMemPool &pool, size_t limit, unsigned long age)
 
std::string FormatStateMessage (const CValidationState &state)
 Convert CValidationState to a human-readable message for logging. More...
 
static bool IsCurrentForFeeEstimation ()
 
void UpdateMempoolForReorg (DisconnectedBlockTransactions &disconnectpool, bool fAddToMempool)
 
static bool CheckInputsFromMempoolAndCache (const CTransaction &tx, CValidationState &state, const CCoinsViewCache &view, CTxMemPool &pool, unsigned int flags, bool cacheSigStore, PrecomputedTransactionData &txdata)
 
static bool AcceptToMemoryPoolWorker (const CChainParams &chainparams, CTxMemPool &pool, CValidationState &state, const CTransactionRef &ptx, bool *pfMissingInputs, int64_t nAcceptTime, bool bypass_limits, const CAmount &nAbsurdFee, std::vector< COutPoint > &coins_to_uncache, bool fDryRun)
 
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)
 (try to) add transaction to memory pool with a specified acceptance time More...
 
bool AcceptToMemoryPool (CTxMemPool &pool, CValidationState &state, const CTransactionRef &tx, bool *pfMissingInputs, bool bypass_limits, const CAmount nAbsurdFee, bool fDryRun)
 (try to) add transaction to memory pool 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, int end)
 
bool GetAddressUnspent (uint160 addressHash, int type, std::vector< std::pair< CAddressUnspentKey, CAddressUnspentValue > > &unspentOutputs)
 
bool GetTransaction (const uint256 &hash, CTransactionRef &txOut, const Consensus::Params &consensusParams, uint256 &hashBlock, bool fAllowSlow, CBlockIndex *blockIndex)
 Return transaction in txOut, and if it was found inside a block, its hash is placed in hashBlock. More...
 
static bool WriteBlockToDisk (const CBlock &block, CDiskBlockPos &pos, const CMessageHeader::MessageStartChars &messageStart)
 
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)
 
double ConvertBitsToDouble (unsigned int nBits)
 
CAmount GetBlockSubsidy (int nPrevBits, int nPrevHeight, const Consensus::Params &consensusParams, bool fSuperblockPartOnly)
 
CAmount GetMasternodePayment (int nHeight, CAmount blockValue, int nReallocActivationHeight)
 
bool IsInitialBlockDownload ()
 Check whether we are doing an initial block download (synchronizing from disk or network) More...
 
static void AlertNotify (const std::string &strMessage)
 
static void CheckForkWarningConditions ()
 
static void CheckForkWarningConditionsOnNewFork (CBlockIndex *pindexNewForkTip)
 
static void InvalidChainFound (CBlockIndex *pindexNew)
 
void UpdateCoins (const CTransaction &tx, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight)
 
void UpdateCoins (const CTransaction &tx, CCoinsViewCache &inputs, int nHeight)
 Apply the effects of this transaction on the UTXO set represented by view. More...
 
int GetSpendHeight (const CCoinsViewCache &inputs)
 Return the spend height, which is one more than the inputs.GetBestBlock(). More...
 
void InitScriptExecutionCache ()
 Initializes the script-execution cache. More...
 
int ApplyTxInUndo (Coin &&undo, CCoinsViewCache &view, const COutPoint &out)
 Restore the UTXO in a Coin at a given COutPoint. More...
 
static void FlushBlockFile (bool fFinalize=false)
 
static bool FindUndoPos (CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize)
 
static bool WriteUndoDataForBlock (const CBlockUndo &blockundo, CValidationState &state, CBlockIndex *pindex, const CChainParams &chainparams)
 
static bool WriteTxIndexDataForBlock (const CBlock &block, CValidationState &state, CBlockIndex *pindex)
 
void ThreadScriptCheck ()
 Run an instance of the script checking thread. More...
 
int32_t ComputeBlockVersion (const CBlockIndex *pindexPrev, const Consensus::Params &params, bool fCheckMasternodesUpgraded)
 Determine what nVersion a new block should use. More...
 
bool GetBlockHash (uint256 &hashRet, int nBlockHeight)
 Return true if hash can be found in chainActive at nBlockHeight height. More...
 
void FlushStateToDisk ()
 Flush all state, indexes and buffers to disk. More...
 
void PruneAndFlush ()
 Prune block files and flush state to disk. More...
 
static void DoWarning (const std::string &strWarning)
 
static void UpdateTip (const CBlockIndex *pindexNew, const CChainParams &chainParams)
 Check warning conditions and do some notifications on new chain tip set. More...
 
static void NotifyHeaderTip ()
 
bool ActivateBestChain (CValidationState &state, const CChainParams &chainparams, std::shared_ptr< const CBlock > pblock)
 Find the best known block, and make it the tip of the block chain. 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...
 
static bool FindBlockPos (CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown=false)
 
static bool CheckBlockHeader (const CBlockHeader &block, CValidationState &state, const Consensus::Params &consensusParams, bool fCheckPOW=true)
 
bool CheckBlock (const CBlock &block, CValidationState &state, const Consensus::Params &consensusParams, bool fCheckPOW, bool fCheckMerkleRoot)
 Functions for validating blocks and updating the block tree. More...
 
static bool ContextualCheckBlockHeader (const CBlockHeader &block, CValidationState &state, const CChainParams &params, const CBlockIndex *pindexPrev, int64_t nAdjustedTime)
 Context-dependent validity checks. More...
 
static bool ContextualCheckBlock (const CBlock &block, CValidationState &state, const Consensus::Params &consensusParams, const CBlockIndex *pindexPrev)
 NOTE: This function is not currently invoked by ConnectBlock(), so we should consider upgrade issues if we change which consensus rules are enforced in this function (eg by adding a new consensus rule). More...
 
bool ProcessNewBlockHeaders (const std::vector< CBlockHeader > &headers, CValidationState &state, const CChainParams &chainparams, const CBlockIndex **ppindex, CBlockHeader *first_invalid)
 Process incoming block headers. More...
 
static CDiskBlockPos SaveBlockToDisk (const CBlock &block, int nHeight, const CChainParams &chainparams, const CDiskBlockPos *dbp)
 Store block on disk. More...
 
bool ProcessNewBlock (const CChainParams &chainparams, const std::shared_ptr< const CBlock > pblock, bool fForceProcessing, bool *fNewBlock)
 Process an incoming block. More...
 
bool TestBlockValidity (CValidationState &state, const CChainParams &chainparams, const CBlock &block, CBlockIndex *pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot)
 Check a block is completely valid from start to finish (only works on top of our current best block, with cs_main held) More...
 
uint64_t CalculateCurrentUsage ()
 BLOCK PRUNING CODE. 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 PruneBlockFilesManual (int nManualPruneHeight)
 Prune block files up to a given height. More...
 
bool CheckDiskSpace (uint64_t nAdditionalBytes)
 Check whether enough disk space is available for an incoming block. More...
 
static FILE * OpenDiskFile (const CDiskBlockPos &pos, const char *prefix, bool fReadOnly)
 
FILE * OpenBlockFile (const CDiskBlockPos &pos, bool fReadOnly)
 Open a block file (blk?????.dat) More...
 
fs::path GetBlockPosFilename (const CDiskBlockPos &pos, const char *prefix)
 Translation to a filesystem path. More...
 
static bool LoadBlockIndexDB (const CChainParams &chainparams)
 
bool LoadChainTip (const CChainParams &chainparams)
 Update the chain tip based on database information. More...
 
bool ReplayBlocks (const CChainParams &params, CCoinsView *view)
 Replay blocks that aren't fully applied to the database. More...
 
void UnloadBlockIndex ()
 Unload database information. 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 LoadGenesisBlock (const CChainParams &chainparams)
 Ensures we have a genesis block in the block tree, possibly writing one to disk. More...
 
bool LoadExternalBlockFile (const CChainParams &chainparams, FILE *fileIn, CDiskBlockPos *dbp)
 Import blocks from an external file. More...
 
CBlockFileInfoGetBlockFileInfo (size_t n)
 Get block file info entry for one block file. 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...
 
bool LoadMempool (void)
 Load the mempool from disk. More...
 
bool DumpMempool (void)
 Dump the mempool to disk. More...
 
double GuessVerificationProgress (const ChainTxData &data, const CBlockIndex *pindex)
 Guess how far we are in the verification process at the given block index. More...
 

Variables

class CChainState g_chainstate
 
CCriticalSection cs_main
 
BlockMapmapBlockIndex = g_chainstate.mapBlockIndex
 
PrevBlockMapmapPrevBlockIndex = g_chainstate.mapPrevBlockIndex
 
CChainchainActive = g_chainstate.chainActive
 The currently-connected chain of blocks (protected by cs_main). More...
 
CBlockIndexpindexBestHeader = nullptr
 Best header we've seen so far (used for getheaders queries' starting points). More...
 
CWaitableCriticalSection g_best_block_mutex
 
CConditionVariable g_best_block_cv
 
uint256 g_best_block
 
int nScriptCheckThreads = 0
 
bool fTxIndex = true
 
bool fAddressIndex = false
 
bool fTimestampIndex = false
 
bool fSpentIndex = false
 
bool fHavePruned = false
 Pruning-related variables and constants. More...
 
bool fPruneMode = false
 True if we're running in -prune mode. More...
 
bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG
 
bool fRequireStandard = true
 
unsigned int nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP
 
bool fCheckBlockIndex = false
 
bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED
 
size_t nCoinCacheUsage = 5000 * 300
 
uint64_t nPruneTarget = 0
 Number of MiB of block files that we're trying to stay below. More...
 
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE
 If the tip is older than this (in seconds), the node is considered to be in initial block download. More...
 
std::atomic< bool > fDIP0001ActiveAtTip {false}
 
std::atomic< bool > fDIP0003ActiveAtTip {false}
 
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...
 
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE)
 A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) More...
 
CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE
 Absolute maximum transaction fee (in duffs) used by wallet and mempool (rejects high fee in sendrawtransaction) More...
 
CBlockPolicyEstimator feeEstimator
 
CScript COINBASE_FLAGS
 Constant stuff for coinbase transactions we create: More...
 
const std::string strMessageMagic = "DarkCoin Signed Message:\n"
 
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...
 
CBlockIndexpindexBestForkTip = nullptr
 
CBlockIndexpindexBestForkBase = nullptr
 
static CuckooCache::cache< uint256, SignatureCacheHasherscriptExecutionCache
 
static uint256 scriptExecutionCacheNonce (GetRandHash())
 
static CCheckQueue< CScriptCheckscriptcheckqueue (128)
 
VersionBitsCache versionbitscache
 
static ThresholdConditionCache warningcache [VERSIONBITS_NUM_BITS]
 
static int64_t nTimeCheck = 0
 
static int64_t nTimeForks = 0
 
static int64_t nTimeVerify = 0
 
static int64_t nTimeISFilter = 0
 
static int64_t nTimeSubsidy = 0
 
static int64_t nTimeValueValid = 0
 
static int64_t nTimePayeeValid = 0
 
static int64_t nTimeProcessSpecial = 0
 
static int64_t nTimeDashSpecific = 0
 
static int64_t nTimeConnect = 0
 
static int64_t nTimeIndex = 0
 
static int64_t nTimeCallbacks = 0
 
static int64_t nTimeTotal = 0
 
static int64_t nBlocksTotal = 0
 
static int64_t nTimeReadFromDisk = 0
 
static int64_t nTimeConnectTotal = 0
 
static int64_t nTimeFlush = 0
 
static int64_t nTimeChainState = 0
 
static int64_t nTimePostConnect = 0
 
static const uint64_t MEMPOOL_DUMP_VERSION = 1
 
class CMainCleanup instance_of_cmaincleanup
 

Macro Definition Documentation

◆ MICRO

#define MICRO   0.000001

Definition at line 65 of file validation.cpp.

Referenced by CChainState::ConnectBlock(), CChainState::ConnectTip(), and DumpMempool().

◆ MILLI

#define MILLI   0.001

Enumeration Type Documentation

◆ DisconnectResult

Enumerator
DISCONNECT_OK 
DISCONNECT_UNCLEAN 
DISCONNECT_FAILED 

Definition at line 94 of file validation.cpp.

◆ FlushStateMode

Enumerator
FLUSH_STATE_NONE 
FLUSH_STATE_IF_NEEDED 
FLUSH_STATE_PERIODIC 
FLUSH_STATE_ALWAYS 

Definition at line 303 of file validation.cpp.

Function Documentation

◆ AcceptToMemoryPool()

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

◆ 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 
)
static

(try to) add transaction to memory pool with a specified acceptance time

Definition at line 873 of file validation.cpp.

References AcceptToMemoryPoolWorker(), FLUSH_STATE_PERIODIC, FlushStateToDisk(), CValidationState::GetDebugMessage(), CValidationState::GetRejectReason(), LogPrint, BCLog::MEMPOOL, and pcoinsTip.

Referenced by AcceptToMemoryPool(), and LoadMempool().

◆ AcceptToMemoryPoolWorker()

static bool AcceptToMemoryPoolWorker ( const CChainParams chainparams,
CTxMemPool pool,
CValidationState state,
const CTransactionRef ptx,
bool *  pfMissingInputs,
int64_t  nAcceptTime,
bool  bypass_limits,
const CAmount nAbsurdFee,
std::vector< COutPoint > &  coins_to_uncache,
bool  fDryRun 
)
static

Definition at line 621 of file validation.cpp.

References CCoinsViewCache::AccessCoin(), CTxMemPool::addAddressIndex(), CTxMemPool::addSpentIndex(), CTxMemPool::addUnchecked(), CTxMemPool::ApplyDelta(), AreInputsStandard(), AssertLockHeld(), CTxMemPool::CalculateMemPoolAncestors(), chainActive, CheckFinalTx(), CheckInputs(), CheckInputsFromMempoolAndCache(), CheckSequenceLocks(), CheckSpecialTx(), CheckTransaction(), Consensus::CheckTxInputs(), ContextualCheckTransaction(), CTxMemPool::cs, cs_main, DEFAULT_ANCESTOR_LIMIT, DEFAULT_ANCESTOR_SIZE_LIMIT, DEFAULT_DESCENDANT_LIMIT, DEFAULT_DESCENDANT_SIZE_LIMIT, DEFAULT_MAX_MEMPOOL_SIZE, DEFAULT_MEMPOOL_EXPIRY, CValidationState::DoS(), indirectmap< K, T >::end(), error(), CTxMemPool::exists(), CTxMemPool::existsProviderTxConflict(), fAddressIndex, indirectmap< K, T >::find(), FormatStateMessage(), fRequireStandard, fSpentIndex, gArgs, ArgsManager::GetArg(), CCoinsViewCache::GetBestBlock(), GetBlockScriptFlags(), llmq::CInstantSendManager::GetConflictingLock(), CChainParams::GetConsensus(), CFeeRate::GetFee(), CTransaction::GetHash(), GetMainSignals(), CTxMemPool::GetMinFee(), GetSpendHeight(), GetTransaction(), GetTransactionSigOpCount(), CTxMemPoolEntry::GetTxSize(), CTxMemPool::HasNoInputsOf(), CCoinsViewCache::HaveCoin(), CChain::Height(), CValidationState::Invalid(), Coin::IsCoinBase(), CTransaction::IsCoinBase(), IsCurrentForFeeEstimation(), IsStandardTx(), LimitMempoolSize(), LOCK, CTxMemPool::mapNextTx, MAX_STANDARD_TX_SIGOPS, minRelayTxFee, nBytesPerSigOp, CMainSignals::NotifyInstantSendDoubleSpendAttempt(), CTransaction::nType, CTransaction::nVersion, pcoinsTip, CTxIn::prevout, llmq::quorumInstantSendManager, REJECT_DUPLICATE, REJECT_HIGHFEE, REJECT_INSUFFICIENTFEE, REJECT_INVALID, REJECT_NONSTANDARD, CCoinsViewBacked::SetBackend(), STANDARD_LOCKTIME_VERIFY_FLAGS, STANDARD_SCRIPT_VERIFY_FLAGS, strprintf, CChain::Tip(), base_blob< BITS >::ToString(), TRANSACTION_QUORUM_COMMITMENT, CMainSignals::TransactionAddedToMempool(), CTransaction::vin, and CTransaction::vout.

Referenced by AcceptToMemoryPoolWithTime().

◆ ActivateBestChain()

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

◆ AlertNotify()

static void AlertNotify ( const std::string &  strMessage)
static

◆ ApplyTxInUndo()

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

Restore the UTXO in a Coin at a given COutPoint.

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

Definition at line 1602 of file validation.cpp.

References AccessByTxid(), CCoinsViewCache::AddCoin(), DISCONNECT_FAILED, DISCONNECT_OK, DISCONNECT_UNCLEAN, Coin::fCoinBase, COutPoint::hash, CCoinsViewCache::HaveCoin(), Coin::IsSpent(), and Coin::nHeight.

Referenced by CChainState::DisconnectBlock().

◆ CalculateCurrentUsage()

uint64_t CalculateCurrentUsage ( )

BLOCK PRUNING CODE.

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

◆ CheckBlockHeader()

◆ CheckBlockIndex()

static void CheckBlockIndex ( const Consensus::Params consensusParams)
static

◆ CheckDiskSpace()

bool CheckDiskSpace ( uint64_t  nAdditionalBytes)

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 
)

◆ CheckForkWarningConditions()

◆ CheckForkWarningConditionsOnNewFork()

◆ CheckInputs()

bool CheckInputs ( const CTransaction tx,
CValidationState state,
const CCoinsViewCache inputs,
bool  fScriptChecks,
unsigned int  flags,
bool  cacheSigStore,
bool  cacheFullScriptStore,
PrecomputedTransactionData txdata,
std::vector< CScriptCheck > *  pvChecks 
)

Check whether all inputs of this transaction are valid (no double spends, scripts & sigs, amounts) This does not modify the UTXO set.

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

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

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

Definition at line 1432 of file validation.cpp.

References CCoinsViewCache::AccessCoin(), AssertLockHeld(), base_blob< BITS >::begin(), cs_main, CValidationState::DoS(), CSHA256::Finalize(), flags, CTransaction::GetHash(), CValidationState::Invalid(), CTransaction::IsCoinBase(), Coin::IsSpent(), Coin::out, REJECT_INVALID, REJECT_NONSTANDARD, ScriptErrorString(), scriptExecutionCache, scriptExecutionCacheNonce, STANDARD_NOT_MANDATORY_VERIFY_FLAGS, strprintf, CTransaction::vin, and CSHA256::Write().

Referenced by AcceptToMemoryPoolWorker(), CheckInputsFromMempoolAndCache(), and CChainState::ConnectBlock().

◆ CheckInputsFromMempoolAndCache()

static bool CheckInputsFromMempoolAndCache ( const CTransaction tx,
CValidationState state,
const CCoinsViewCache view,
CTxMemPool pool,
unsigned int  flags,
bool  cacheSigStore,
PrecomputedTransactionData txdata 
)
static

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

◆ ContextualCheckBlock()

static bool ContextualCheckBlock ( const CBlock block,
CValidationState state,
const Consensus::Params consensusParams,
const CBlockIndex pindexPrev 
)
static

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

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

Definition at line 3543 of file validation.cpp.

References Consensus::Params::BIP34Height, ContextualCheckTransaction(), Consensus::DEPLOYMENT_CSV, Consensus::Params::DIP0001Height, Consensus::Params::DIP0003Height, CValidationState::DoS(), expect, CBlockHeader::GetBlockTime(), GetLegacySigOpCount(), CBlockIndex::GetMedianTimePast(), GetSerializeSize(), IsFinalTx(), LOCKTIME_MEDIAN_TIME_PAST, MaxBlockSigOps(), MaxBlockSize(), CBlockIndex::nHeight, PROTOCOL_VERSION, REJECT_INVALID, SER_NETWORK, THRESHOLD_ACTIVE, TRANSACTION_COINBASE, versionbitscache, VersionBitsState(), and CBlock::vtx.

Referenced by CChainState::AcceptBlock(), and TestBlockValidity().

◆ ContextualCheckBlockHeader()

static bool ContextualCheckBlockHeader ( const CBlockHeader block,
CValidationState state,
const CChainParams params,
const CBlockIndex pindexPrev,
int64_t  nAdjustedTime 
)
static

Context-dependent validity checks.

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

Definition at line 3488 of file validation.cpp.

References Consensus::Params::BIP34Height, Consensus::Params::BIP65Height, Consensus::Params::BIP66Height, CChainParams::Checkpoints(), ConvertBitsToDouble(), CValidationState::DoS(), error(), fCheckpointsEnabled, CBlockHeader::GetBlockTime(), CChainParams::GetConsensus(), Checkpoints::GetLastCheckpoint(), CBlockIndex::GetMedianTimePast(), GetNextWorkRequired(), CValidationState::Invalid(), CBaseChainParams::MAIN, MAX_FUTURE_BLOCK_TIME, CBlockHeader::nBits, CBlockIndex::nHeight, CBlockHeader::nVersion, Params(), REJECT_CHECKPOINT, REJECT_INVALID, REJECT_OBSOLETE, and strprintf.

Referenced by CChainState::AcceptBlockHeader(), and TestBlockValidity().

◆ ContextualCheckTransaction()

◆ ConvertBitsToDouble()

double ConvertBitsToDouble ( unsigned int  nBits)

Definition at line 1083 of file validation.cpp.

Referenced by ContextualCheckBlockHeader(), and GetBlockSubsidy().

◆ DoWarning()

static void DoWarning ( const std::string &  strWarning)
static

Definition at line 2539 of file validation.cpp.

References AlertNotify(), and SetMiscWarning().

Referenced by UpdateTip().

◆ DumpMempool()

◆ fImporting()

std::atomic_bool fImporting ( false  )

Referenced by IsInitialBlockDownload().

◆ FindBlockPos()

static bool FindBlockPos ( CDiskBlockPos pos,
unsigned int  nAddSize,
unsigned int  nHeight,
uint64_t  nTime,
bool  fKnown = false 
)
static

◆ FindFilesToPrune()

static void FindFilesToPrune ( std::set< int > &  setFilesToPrune,
uint64_t  nPruneAfterHeight 
)
static

Prune block and undo files (blk???.dat and undo???.dat) so that the disk space used is less than a user-defined target.

The user sets the target (in MB) on the command line or in config file. This will be run on startup and whenever new space is allocated in a block or undo file, staying below the target. Changing back to unpruned requires a reindex (which in this case means the blockchain must be re-downloaded.)

Pruning functions are called from FlushStateToDisk when the global fCheckForPruning flag has been set. Block and undo files are deleted in lock-step (when blk00003.dat is deleted, so is rev00003.dat.) Pruning cannot take place until the longest chain is at least a certain length (100000 on mainnet, 1000 on testnet, 1000 on regtest). Pruning will never delete a block within a defined distance (currently 288) from the active chain's tip. The block index is updated by unsetting HAVE_DATA and HAVE_UNDO for any blocks that were stored in the deleted files. A db flag records the fact that at least some block files have been pruned.

Parameters
[out]setFilesToPruneThe set of file indices that can be unlinked will be returned

Definition at line 3975 of file validation.cpp.

References BLOCKFILE_CHUNK_SIZE, CalculateCurrentUsage(), chainActive, count, cs_main, LOCK2, LogPrint, MIN_BLOCKS_TO_KEEP, CBlockIndex::nHeight, nPruneTarget, BCLog::PRUNE, PruneOneBlockFile(), CChain::Tip(), and UNDOFILE_CHUNK_SIZE.

Referenced by FlushStateToDisk().

◆ FindFilesToPruneManual()

static void FindFilesToPruneManual ( std::set< int > &  setFilesToPrune,
int  nManualPruneHeight 
)
static

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

◆ FindUndoPos()

static bool FindUndoPos ( CValidationState state,
int  nFile,
CDiskBlockPos pos,
unsigned int  nAddSize 
)
static

◆ FlushBlockFile()

static void FlushBlockFile ( bool  fFinalize = false)
static

Definition at line 1800 of file validation.cpp.

References FileCommit(), LOCK, OpenBlockFile(), OpenUndoFile(), and TruncateFile().

Referenced by FindBlockPos(), and FlushStateToDisk().

◆ FlushStateToDisk() [1/2]

◆ FlushStateToDisk() [2/2]

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

◆ fReindex()

std::atomic_bool fReindex ( false  )

◆ GetAddressIndex()

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

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

◆ GetBlockScriptFlags()

◆ GetBlockSubsidy()

◆ GetMasternodePayment()

◆ 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()

bool GetTransaction ( const uint256 hash,
CTransactionRef txOut,
const Consensus::Params consensusParams,
uint256 hashBlock,
bool  fAllowSlow,
CBlockIndex blockIndex 
)

◆ 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 how far we are in the verification process at the given block index.

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 
)

◆ InvalidChainFound()

◆ IsCurrentForFeeEstimation()

◆ IsInitialBlockDownload()

◆ LimitMempoolSize()

static void LimitMempoolSize ( CTxMemPool pool,
size_t  limit,
unsigned long  age 
)
static

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

◆ LoadBlockIndexDB()

◆ 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()

◆ NotifyHeaderTip()

◆ OpenBlockFile()

FILE* OpenBlockFile ( const CDiskBlockPos pos,
bool  fReadOnly 
)

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

◆ OpenDiskFile()

static FILE* OpenDiskFile ( const CDiskBlockPos pos,
const char *  prefix,
bool  fReadOnly 
)
static

◆ OpenUndoFile()

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

Open an undo file (rev?????.dat)

Definition at line 4061 of file validation.cpp.

References OpenDiskFile().

Referenced by FindUndoPos(), and FlushBlockFile().

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

◆ SaveBlockToDisk()

static CDiskBlockPos SaveBlockToDisk ( const CBlock block,
int  nHeight,
const CChainParams chainparams,
const CDiskBlockPos dbp 
)
static

Store block on disk.

If dbp is non-nullptr, the file is known to already reside on disk

Definition at line 3703 of file validation.cpp.

References CLIENT_VERSION, error(), FindBlockPos(), CBlockHeader::GetBlockTime(), GetSerializeSize(), CChainParams::MessageStart(), SER_DISK, and WriteBlockToDisk().

Referenced by CChainState::AcceptBlock(), and CChainState::AddGenesisBlock().

◆ TestBlockValidity()

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

◆ 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() [1/2]

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

◆ UpdateCoins() [2/2]

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

◆ UpdateMempoolForReorg()

◆ UpdateTip()

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

◆ WriteBlockToDisk()

static bool WriteBlockToDisk ( const CBlock block,
CDiskBlockPos pos,
const CMessageHeader::MessageStartChars messageStart 
)
static

◆ WriteTxIndexDataForBlock()

static bool WriteTxIndexDataForBlock ( const CBlock block,
CValidationState state,
CBlockIndex pindex 
)
static

◆ WriteUndoDataForBlock()

Variable Documentation

◆ chainActive

CChain& chainActive = g_chainstate.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().

◆ fAddressIndex

◆ fCheckBlockIndex

bool fCheckBlockIndex = false

Definition at line 234 of file validation.cpp.

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

◆ fCheckpointsEnabled

bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED

Definition at line 235 of file validation.cpp.

Referenced by AppInitParameterInteraction(), and ContextualCheckBlockHeader().

◆ fDIP0001ActiveAtTip

◆ fDIP0003ActiveAtTip

std::atomic<bool> fDIP0003ActiveAtTip {false}

Definition at line 241 of file validation.cpp.

◆ feeEstimator

◆ fHavePruned

bool fHavePruned = false

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

◆ fIsBareMultisigStd

bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG

Definition at line 231 of file validation.cpp.

Referenced by AppInitParameterInteraction(), and IsStandardTx().

◆ fPruneMode

◆ fRequireStandard

bool fRequireStandard = true

Definition at line 232 of file validation.cpp.

Referenced by AcceptToMemoryPoolWorker(), and AppInitParameterInteraction().

◆ fSpentIndex

◆ fTimestampIndex

bool fTimestampIndex = false

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

◆ g_chainstate

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

◆ instance_of_cmaincleanup

class CMainCleanup instance_of_cmaincleanup

◆ mapBlockIndex

BlockMap& mapBlockIndex = g_chainstate.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 = g_chainstate.mapPrevBlockIndex

Definition at line 216 of file validation.cpp.

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

◆ maxTxFee

◆ MEMPOOL_DUMP_VERSION

const uint64_t MEMPOOL_DUMP_VERSION = 1
static

Definition at line 4907 of file validation.cpp.

Referenced by DumpMempool(), and LoadMempool().

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

◆ nBlocksTotal

int64_t nBlocksTotal = 0
static

Definition at line 1978 of file validation.cpp.

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

◆ nBytesPerSigOp

unsigned int nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP

Definition at line 233 of file validation.cpp.

Referenced by AcceptToMemoryPoolWorker(), and AppInitParameterInteraction().

◆ nCoinCacheUsage

size_t nCoinCacheUsage = 5000 * 300

Definition at line 236 of file validation.cpp.

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

◆ nMaxTipAge

int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE

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

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

◆ nPruneTarget

uint64_t nPruneTarget = 0

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 = 0

◆ nTimeCallbacks

int64_t nTimeCallbacks = 0
static

Definition at line 1976 of file validation.cpp.

Referenced by CChainState::ConnectBlock().

◆ nTimeChainState

int64_t nTimeChainState = 0
static

Definition at line 2667 of file validation.cpp.

Referenced by CChainState::ConnectTip().

◆ nTimeCheck

int64_t nTimeCheck = 0
static

Definition at line 1965 of file validation.cpp.

Referenced by CChainState::ConnectBlock().

◆ nTimeConnect

int64_t nTimeConnect = 0
static

Definition at line 1974 of file validation.cpp.

Referenced by CChainState::ConnectBlock().

◆ nTimeConnectTotal

int64_t nTimeConnectTotal = 0
static

Definition at line 2665 of file validation.cpp.

Referenced by CChainState::ConnectTip().

◆ nTimeDashSpecific

int64_t nTimeDashSpecific = 0
static

Definition at line 1973 of file validation.cpp.

Referenced by CChainState::ConnectBlock().

◆ nTimeFlush

int64_t nTimeFlush = 0
static

Definition at line 2666 of file validation.cpp.

Referenced by CChainState::ConnectTip().

◆ nTimeForks

int64_t nTimeForks = 0
static

Definition at line 1966 of file validation.cpp.

Referenced by CChainState::ConnectBlock().

◆ nTimeIndex

int64_t nTimeIndex = 0
static

Definition at line 1975 of file validation.cpp.

Referenced by CChainState::ConnectBlock().

◆ nTimeISFilter

int64_t nTimeISFilter = 0
static

Definition at line 1968 of file validation.cpp.

Referenced by CChainState::ConnectBlock().

◆ nTimePayeeValid

int64_t nTimePayeeValid = 0
static

Definition at line 1971 of file validation.cpp.

Referenced by CChainState::ConnectBlock().

◆ nTimePostConnect

int64_t nTimePostConnect = 0
static

Definition at line 2668 of file validation.cpp.

Referenced by CChainState::ConnectTip().

◆ nTimeProcessSpecial

int64_t nTimeProcessSpecial = 0
static

Definition at line 1972 of file validation.cpp.

Referenced by CChainState::ConnectBlock().

◆ nTimeReadFromDisk

int64_t nTimeReadFromDisk = 0
static

Definition at line 2664 of file validation.cpp.

Referenced by CChainState::ConnectTip().

◆ nTimeSubsidy

int64_t nTimeSubsidy = 0
static

Definition at line 1969 of file validation.cpp.

Referenced by CChainState::ConnectBlock().

◆ nTimeTotal

int64_t nTimeTotal = 0
static

Definition at line 1977 of file validation.cpp.

Referenced by CChainState::ConnectTip().

◆ nTimeValueValid

int64_t nTimeValueValid = 0
static

Definition at line 1970 of file validation.cpp.

Referenced by CChainState::ConnectBlock().

◆ nTimeVerify

int64_t nTimeVerify = 0
static

Definition at line 1967 of file validation.cpp.

Referenced by CChainState::ConnectBlock().

◆ 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

◆ pindexBestForkBase

CBlockIndex * pindexBestForkBase = nullptr

◆ pindexBestForkTip

CBlockIndex* pindexBestForkTip = nullptr

◆ pindexBestHeader

◆ scriptcheckqueue

CCheckQueue<CScriptCheck> scriptcheckqueue(128)
static

◆ scriptExecutionCache

CuckooCache::cache<uint256, SignatureCacheHasher> scriptExecutionCache
static

Definition at line 1406 of file validation.cpp.

Referenced by CheckInputs(), and InitScriptExecutionCache().

◆ scriptExecutionCacheNonce

uint256 scriptExecutionCacheNonce(GetRandHash())
static

Referenced by CheckInputs().

◆ strMessageMagic

◆ versionbitscache

◆ warningcache

Definition at line 1929 of file validation.cpp.

Referenced by UnloadBlockIndex(), and UpdateTip().

Released under the MIT license