Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#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>
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) |
CBlockIndex * | FindForkInGlobalIndex (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 ¶ms, 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 ¶ms, 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 ¶ms, 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 ¶ms, 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... | |
CBlockFileInfo * | GetBlockFileInfo (size_t n) |
Get block file info entry for one block file. More... | |
ThresholdState | VersionBitsTipState (const Consensus::Params ¶ms, Consensus::DeploymentPos pos) |
Get the BIP9 state for a given deployment at the current tip. More... | |
BIP9Stats | VersionBitsTipStatistics (const Consensus::Params ¶ms, 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 ¶ms, 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 |
BlockMap & | mapBlockIndex = g_chainstate.mapBlockIndex |
PrevBlockMap & | mapPrevBlockIndex = g_chainstate.mapPrevBlockIndex |
CChain & | chainActive = g_chainstate.chainActive |
The currently-connected chain of blocks (protected by cs_main). More... | |
CBlockIndex * | pindexBestHeader = 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< CCoinsViewDB > | pcoinsdbview |
Global variable that points to the coins database (protected by cs_main) More... | |
std::unique_ptr< CCoinsViewCache > | pcoinsTip |
Global variable that points to the active CCoinsView (protected by cs_main) More... | |
std::unique_ptr< CBlockTreeDB > | pblocktree |
Global variable that points to the active block tree (protected by cs_main) More... | |
CBlockIndex * | pindexBestForkTip = nullptr |
CBlockIndex * | pindexBestForkBase = nullptr |
static CuckooCache::cache< uint256, SignatureCacheHasher > | scriptExecutionCache |
static uint256 | scriptExecutionCacheNonce (GetRandHash()) |
static CCheckQueue< CScriptCheck > | scriptcheckqueue (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 |
Definition at line 66 of file validation.cpp.
Referenced by CChainState::ConnectBlock(), CChainState::ConnectTip(), and CChainState::DisconnectTip().
Enumeration Type Documentation
◆ DisconnectResult
enum DisconnectResult |
Enumerator | |
---|---|
DISCONNECT_OK | |
DISCONNECT_UNCLEAN | |
DISCONNECT_FAILED |
Definition at line 94 of file validation.cpp.
◆ FlushStateMode
enum 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 | ||
) |
(try to) add transaction to memory pool
Definition at line 890 of file validation.cpp.
References AcceptToMemoryPoolWithTime(), GetTime(), and Params().
Referenced by CPrivateSendServer::CommitFinalTransaction(), CPrivateSendServer::ConsumeCollateral(), CPrivateSend::IsCollateralValid(), ProcessMessage(), sendrawtransaction(), UpdateMempoolForReorg(), and while().
◆ AcceptToMemoryPoolWithTime()
|
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 |
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 | ||
) |
Find the best known block, and make it the tip of the block chain.
Definition at line 3072 of file validation.cpp.
References CChainState::ActivateBestChain(), and g_chainstate.
Referenced by llmq::CChainLocksHandler::EnforceBestChainLock(), invalidateblock(), LoadChainTip(), LoadExternalBlockFile(), ProcessGetBlockData(), ProcessMessage(), reconsiderblock(), llmq::CInstantSendManager::ResolveBlockConflicts(), and ThreadImport().
◆ AlertNotify()
|
static |
Definition at line 1246 of file validation.cpp.
References gArgs, ArgsManager::GetArg(), CClientUIInterface::NotifyAlertChanged, runCommand(), SanitizeString(), and uiInterface.
Referenced by CheckForkWarningConditions(), and DoWarning().
◆ ApplyTxInUndo()
int ApplyTxInUndo | ( | Coin && | undo, |
CCoinsViewCache & | view, | ||
const COutPoint & | out | ||
) |
Restore the UTXO in a Coin at a given COutPoint.
- Parameters
-
undo The Coin to be restored. view The coins view to which to apply the changes. out The 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()
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.
Context-independent validity checks
Definition at line 3417 of file validation.cpp.
References BlockMerkleRoot(), CheckBlockHeader(), CheckTransaction(), CValidationState::DoS(), CBlock::fChecked, CValidationState::GetDebugMessage(), GetLegacySigOpCount(), CValidationState::GetRejectCode(), CValidationState::GetRejectReason(), GetSerializeSize(), CBlockHeader::hashMerkleRoot, CValidationState::Invalid(), MaxBlockSigOps(), MaxBlockSize(), PROTOCOL_VERSION, REJECT_INVALID, SER_NETWORK, strprintf, and CBlock::vtx.
Referenced by CChainState::AcceptBlock(), CChainState::ConnectBlock(), DeserializeAndCheckBlockTest(), PartiallyDownloadedBlock::FillBlock(), CChainState::LoadGenesisBlock(), ProcessNewBlock(), TestBlockValidity(), and CVerifyDB::VerifyDB().
◆ CheckBlockHeader()
|
static |
Definition at line 3400 of file validation.cpp.
References CheckProofOfWork(), CValidationState::DoS(), error(), CBlockHeader::GetHash(), Consensus::Params::hashDevnetGenesisBlock, Consensus::Params::hashGenesisBlock, CBlockHeader::hashPrevBlock, base_blob< BITS >::IsNull(), CBlockHeader::nBits, and REJECT_INVALID.
Referenced by CChainState::AcceptBlockHeader(), and CheckBlock().
◆ CheckBlockIndex()
|
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 |
||
) |
Transaction validation functions.
Check if transaction will be final in the next block to be created.
Calls IsFinalTx() with current block height and appropriate block time.
See consensus/consensus.h for flag definitions.
Definition at line 317 of file validation.cpp.
References AssertLockHeld(), chainActive, cs_main, flags, GetAdjustedTime(), CBlockIndex::GetMedianTimePast(), CChain::Height(), IsFinalTx(), LOCKTIME_MEDIAN_TIME_PAST, and CChain::Tip().
Referenced by AcceptToMemoryPoolWorker(), CWallet::AvailableCoins(), TransactionDesc::FormatTxStatus(), CWallet::GetLegacyBalance(), getreceivedbyaccount(), getreceivedbyaddress(), CWalletTx::IsTrusted(), ListReceived(), CTxMemPool::removeForReorg(), and TransactionRecord::updateStatus().
◆ CheckForkWarningConditions()
|
static |
Definition at line 1263 of file validation.cpp.
References AlertNotify(), AssertLockHeld(), chainActive, cs_main, GetBlockProof(), GetfLargeWorkForkFound(), CChain::Height(), IsInitialBlockDownload(), LogPrintf, CBlockIndex::nChainWork, CBlockIndex::nHeight, CBlockIndex::phashBlock, pindexBestForkBase, pindexBestForkTip, SetfLargeWorkForkFound(), SetfLargeWorkInvalidChainFound(), CChain::Tip(), and base_blob< BITS >::ToString().
Referenced by CChainState::ActivateBestChainStep(), CheckForkWarningConditionsOnNewFork(), and InvalidChainFound().
◆ CheckForkWarningConditionsOnNewFork()
|
static |
Definition at line 1311 of file validation.cpp.
References AssertLockHeld(), chainActive, CheckForkWarningConditions(), cs_main, GetBlockProof(), CChain::Height(), CBlockIndex::nChainWork, CBlockIndex::nHeight, pindexBestForkBase, pindexBestForkTip, CBlockIndex::pprev, and CChain::Tip().
Referenced by CChainState::ActivateBestChainStep().
◆ 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 |
Definition at line 587 of file validation.cpp.
References CCoinsViewCache::AccessCoin(), AssertLockHeld(), CheckInputs(), CTxMemPool::cs, cs_main, flags, CTxMemPool::get(), COutPoint::hash, CTransaction::IsCoinBase(), Coin::IsSpent(), LOCK, COutPoint::n, Coin::out, pcoinsTip, CTxIn::prevout, and CTransaction::vin.
Referenced by AcceptToMemoryPoolWorker().
◆ 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 | ||
) |
Determine what nVersion a new block should use.
Definition at line 1874 of file validation.cpp.
References VBDeploymentInfo::check_mn_protocol, cs_main, LOCK, Consensus::MAX_VERSION_BITS_DEPLOYMENTS, THRESHOLD_LOCKED_IN, THRESHOLD_STARTED, VERSIONBITS_TOP_BITS, versionbitscache, VersionBitsDeploymentInfo, VersionBitsMask(), and VersionBitsState().
Referenced by WarningBitsConditionChecker::Condition(), BlockAssembler::CreateNewBlock(), and UpdateTip().
◆ ContextualCheckBlock()
|
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 |
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()
bool ContextualCheckTransaction | ( | const CTransaction & | tx, |
CValidationState & | state, | ||
const Consensus::Params & | consensusParams, | ||
const CBlockIndex * | pindexPrev | ||
) |
Definition at line 465 of file validation.cpp.
References Consensus::Params::DIP0001Height, Consensus::Params::DIP0003Height, CValidationState::DoS(), GetSerializeSize(), CTransaction::IsCoinBase(), MAX_STANDARD_TX_SIZE, CBlockIndex::nHeight, CTransaction::nType, CTransaction::nVersion, PROTOCOL_VERSION, REJECT_INVALID, SER_NETWORK, TRANSACTION_COINBASE, TRANSACTION_NORMAL, TRANSACTION_PROVIDER_REGISTER, TRANSACTION_PROVIDER_UPDATE_REGISTRAR, TRANSACTION_PROVIDER_UPDATE_REVOKE, TRANSACTION_PROVIDER_UPDATE_SERVICE, and TRANSACTION_QUORUM_COMMITMENT.
Referenced by AcceptToMemoryPoolWorker(), and ContextualCheckBlock().
◆ ConvertBitsToDouble()
double ConvertBitsToDouble | ( | unsigned int | nBits | ) |
Definition at line 1083 of file validation.cpp.
Referenced by ContextualCheckBlockHeader(), and GetBlockSubsidy().
◆ DoWarning()
|
static |
Definition at line 2539 of file validation.cpp.
References AlertNotify(), and SetMiscWarning().
Referenced by UpdateTip().
◆ DumpMempool()
bool DumpMempool | ( | ) |
Dump the mempool to disk.
Definition at line 4985 of file validation.cpp.
References CLIENT_VERSION, CTxMemPool::cs, CAutoFile::fclose(), FileCommit(), fsbridge::fopen(), CAutoFile::Get(), GetDataDir(), GetTimeMicros(), CTxMemPool::infoAll(), LOCK, LogPrintf, CTxMemPool::mapDeltas, mempool, MEMPOOL_DUMP_VERSION, MICRO, RenameOver(), and SER_DISK.
Referenced by PrepareShutdown(), and savemempool().
◆ fImporting()
std::atomic_bool fImporting | ( | false | ) |
Referenced by IsInitialBlockDownload().
◆ FindBlockPos()
|
static |
Definition at line 3312 of file validation.cpp.
References AllocateFileRange(), BLOCKFILE_CHUNK_SIZE, CheckDiskSpace(), error(), FlushBlockFile(), fPruneMode, LOCK, LogPrintf, MAX_BLOCKFILE_SIZE, CDiskBlockPos::nFile, CDiskBlockPos::nPos, and OpenBlockFile().
Referenced by SaveBlockToDisk().
◆ FindFilesToPrune()
|
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] setFilesToPrune The 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 |
Definition at line 3931 of file validation.cpp.
References chainActive, count, cs_main, fPruneMode, LOCK2, LogPrintf, MIN_BLOCKS_TO_KEEP, CBlockIndex::nHeight, PruneOneBlockFile(), and CChain::Tip().
Referenced by FlushStateToDisk().
◆ 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 |
Definition at line 3369 of file validation.cpp.
References AllocateFileRange(), CheckDiskSpace(), CValidationState::Error(), fPruneMode, LOCK, LogPrintf, CDiskBlockPos::nFile, CDiskBlockPos::nPos, OpenUndoFile(), and UNDOFILE_CHUNK_SIZE.
Referenced by WriteUndoDataForBlock().
◆ FlushBlockFile()
|
static |
Definition at line 1800 of file validation.cpp.
References FileCommit(), LOCK, OpenBlockFile(), OpenUndoFile(), and TruncateFile().
Referenced by FindBlockPos(), and FlushStateToDisk().
◆ FlushStateToDisk() [1/2]
|
static |
Update the on-disk chain state.
The caches and indexes are flushed depending on the mode we're called with if they're too large, if it's been a while since the last write, or always and in all cases if we're in prune mode and are deleting files.
Definition at line 2414 of file validation.cpp.
References chainActive, CheckDiskSpace(), cs_main, DATABASE_FLUSH_INTERVAL, DATABASE_WRITE_INTERVAL, DEFAULT_MAX_MEMPOOL_SIZE, CTxMemPool::DynamicMemoryUsage(), CValidationState::Error(), evoDb, fHavePruned, FindFilesToPrune(), FindFilesToPruneManual(), FLUSH_STATE_ALWAYS, FLUSH_STATE_IF_NEEDED, FLUSH_STATE_PERIODIC, FlushBlockFile(), fPruneMode, fReindex(), gArgs, ArgsManager::GetArg(), CChain::GetLocator(), GetMainSignals(), GetTimeMicros(), LOCK, MAX_BLOCK_COINSDB_USAGE, mempool, nCoinCacheUsage, pblocktree, pcoinsTip, CChainParams::PruneAfterHeight(), CMainSignals::SetBestChain(), and UnlinkPrunedFiles().
Referenced by CChainState::AcceptBlock(), AcceptToMemoryPoolWithTime(), CChainState::ActivateBestChain(), CChainState::ConnectTip(), CChainState::DisconnectTip(), FlushStateToDisk(), gettxoutsetinfo(), PrepareShutdown(), PruneAndFlush(), and PruneBlockFilesManual().
◆ 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()
std::string FormatStateMessage | ( | const CValidationState & | state | ) |
Convert CValidationState to a human-readable message for logging.
Definition at line 513 of file validation.cpp.
References CValidationState::GetDebugMessage(), CValidationState::GetRejectCode(), CValidationState::GetRejectReason(), and strprintf.
Referenced by CChainState::AcceptBlock(), CChainState::AcceptBlockHeader(), AcceptToMemoryPoolWorker(), CChainState::ConnectBlock(), CChainState::ConnectTip(), BlockAssembler::CreateNewBlock(), llmq::CChainLocksHandler::DoInvalidateBlock(), llmq::CChainLocksHandler::EnforceBestChainLock(), ProcessMessage(), ProcessNewBlock(), llmq::CInstantSendManager::ResolveBlockConflicts(), CChainState::RollforwardBlock(), TestBlockValidity(), ThreadImport(), and CVerifyDB::VerifyDB().
◆ fReindex()
std::atomic_bool fReindex | ( | false | ) |
Referenced by FlushStateToDisk(), IsInitialBlockDownload(), LoadBlockIndex(), and LoadBlockIndexDB().
◆ 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()
|
static |
Definition at line 1931 of file validation.cpp.
References AssertLockHeld(), Consensus::Params::BIP65Height, Consensus::Params::BIP66Height, cs_main, Consensus::DEPLOYMENT_BIP147, Consensus::DEPLOYMENT_CSV, flags, CBlockIndex::GetBlockTime(), CBlockIndex::nHeight, CBlockIndex::pprev, SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY, SCRIPT_VERIFY_CHECKSEQUENCEVERIFY, SCRIPT_VERIFY_DERSIG, SCRIPT_VERIFY_NONE, SCRIPT_VERIFY_NULLDUMMY, SCRIPT_VERIFY_P2SH, THRESHOLD_ACTIVE, versionbitscache, and VersionBitsState().
Referenced by AcceptToMemoryPoolWorker(), and CChainState::ConnectBlock().
◆ GetBlockSubsidy()
CAmount GetBlockSubsidy | ( | int | nPrevBits, |
int | nPrevHeight, | ||
const Consensus::Params & | consensusParams, | ||
bool | fSuperblockPartOnly | ||
) |
Definition at line 1108 of file validation.cpp.
References COIN, ConvertBitsToDouble(), CBaseChainParams::MAIN, Consensus::Params::nBudgetPaymentsStartBlock, Consensus::Params::nHighSubsidyBlocks, Consensus::Params::nHighSubsidyFactor, Consensus::Params::nSubsidyHalvingInterval, and Params().
Referenced by CChainState::ConnectBlock(), BlockAssembler::CreateNewBlock(), getblockstats(), and CSuperblock::GetPaymentsLimit().
◆ GetMasternodePayment()
Definition at line 1158 of file validation.cpp.
References CChainParams::GetConsensus(), Consensus::Params::nMasternodePaymentsIncreaseBlock, Consensus::Params::nMasternodePaymentsIncreasePeriod, Consensus::Params::nSuperblockCycle, and Params().
Referenced by CMasternodePayments::GetBlockTxOuts().
◆ 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 | ||
) |
Return transaction in txOut, and if it was found inside a block, its hash is placed in hashBlock.
Retrieve a transaction (from memory pool, or from disk, if possible)
If blockIndex is provided, the transaction is fetched from the corresponding block.
Definition at line 950 of file validation.cpp.
References AccessByTxid(), chainActive, CLIENT_VERSION, cs_main, error(), fTxIndex, CAutoFile::Get(), CTxMemPool::get(), CBlockIndex::GetBlockHash(), CBlockHeader::GetHash(), CAutoFile::IsNull(), Coin::IsSpent(), LOCK, mapBlockIndex, mempool, Coin::nHeight, CDiskTxPos::nTxOffset, OpenBlockFile(), pblocktree, pcoinsTip, ReadBlockFromDisk(), SER_DISK, base_blob< BITS >::ToString(), and CBlock::vtx.
Referenced by AcceptToMemoryPoolWorker(), BuildDMNListEntry(), llmq::CInstantSendManager::CheckCanLock(), llmq::CChainLocksHandler::Cleanup(), getblockstats(), getrawtransaction(), gettxoutproof(), llmq::CInstantSendManager::HandleNewInputLockRecoveredSig(), CGovernanceObject::IsCollateralValid(), llmq::CInstantSendManager::ProcessInstantSendLock(), and rest_tx().
◆ GetUTXOCoin()
Definition at line 439 of file validation.cpp.
References cs_main, Coin::IsSpent(), LOCK, and pcoinsTip.
Referenced by CDeterministicMNManager::BuildNewListFromBlock(), CheckProRegTx(), CheckProUpRegTx(), GetUTXOHeight(), CPrivateSend::IsCollateralValid(), masternodelist(), ThreadImport(), CDeterministicMN::ToJson(), and MasternodeList::updateDIP3List().
◆ 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 | ||
) |
Mark a block as invalid.
Definition at line 3180 of file validation.cpp.
References g_chainstate, and CChainState::InvalidateBlock().
Referenced by llmq::CChainLocksHandler::DoInvalidateBlock(), invalidateblock(), and llmq::CInstantSendManager::ResolveBlockConflicts().
◆ InvalidChainFound()
|
static |
Definition at line 1344 of file validation.cpp.
References chainActive, CheckForkWarningConditions(), DateTimeStrFormat(), CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockTime(), base_uint< BITS >::getdouble(), CChain::Height(), LogPrintf, CBlockIndex::nChainWork, CBlockIndex::nHeight, CChain::Tip(), and base_blob< BITS >::ToString().
Referenced by CChainState::ActivateBestChainStep(), CChainState::InvalidateBlock(), and CChainState::InvalidBlockFound().
◆ IsCurrentForFeeEstimation()
|
static |
Definition at line 521 of file validation.cpp.
References AssertLockHeld(), chainActive, cs_main, CBlockIndex::GetBlockTime(), GetTime(), CChain::Height(), IsInitialBlockDownload(), MAX_FEE_ESTIMATION_TIP_AGE, CBlockIndex::nHeight, pindexBestHeader, and CChain::Tip().
Referenced by AcceptToMemoryPoolWorker().
◆ IsInitialBlockDownload()
bool IsInitialBlockDownload | ( | ) |
Check whether we are doing an initial block download (synchronizing from disk or network)
Definition at line 1219 of file validation.cpp.
References chainActive, cs_main, fImporting(), fReindex(), CBlockIndex::GetBlockTime(), GetTime(), LOCK, LogPrintf, CBlockIndex::nChainWork, nMaxTipAge, nMinimumChainWork, Params(), and CChain::Tip().
Referenced by CChainState::AcceptBlock(), CChainState::ActivateBestChain(), PeerLogicValidation::BlockChecked(), CheckForkWarningConditions(), getblockchaininfo(), getblocktemplate(), ClientModel::inInitialBlockDownload(), CDSNotificationInterface::InitializeCurrentBlockTip(), CChainState::InvalidateBlock(), IsCurrentForFeeEstimation(), NotifyHeaderTip(), ProcessHeadersMessage(), ProcessMessage(), PeerLogicValidation::SendMessages(), and UpdateTip().
◆ LimitMempoolSize()
|
static |
Definition at line 500 of file validation.cpp.
References CTxMemPool::Expire(), GetTime(), LogPrint, BCLog::MEMPOOL, pcoinsTip, and CTxMemPool::TrimToSize().
Referenced by AcceptToMemoryPoolWorker(), and UpdateMempoolForReorg().
◆ 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()
|
static |
Definition at line 4145 of file validation.cpp.
References BLOCK_HAVE_DATA, CLIENT_VERSION, fAddressIndex, fHavePruned, fReindex(), fSpentIndex, fTimestampIndex, fTxIndex, g_chainstate, CChainParams::GetConsensus(), CChainState::LoadBlockIndex(), LogPrintf, mapBlockIndex, CBlockIndex::nFile, CBlockIndex::nStatus, OpenBlockFile(), pblocktree, and SER_DISK.
Referenced by LoadBlockIndex().
◆ LoadChainTip()
bool LoadChainTip | ( | const CChainParams & | chainparams | ) |
Update the chain tip based on database information.
Definition at line 4214 of file validation.cpp.
References ActivateBestChain(), chainActive, DateTimeStrFormat(), g_chainstate, CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockTime(), GuessVerificationProgress(), CChain::Height(), LogPrintf, mapBlockIndex, pcoinsTip, CChainState::PruneBlockIndexCandidates(), CChain::SetTip(), CChain::Tip(), base_blob< BITS >::ToString(), and CChainParams::TxData().
Referenced by AppInitMain().
◆ LoadExternalBlockFile()
bool LoadExternalBlockFile | ( | const CChainParams & | chainparams, |
FILE * | fileIn, | ||
CDiskBlockPos * | dbp | ||
) |
Import blocks from an external file.
Definition at line 4576 of file validation.cpp.
References CChainState::AcceptBlock(), ActivateBestChain(), BLOCK_HAVE_DATA, CLIENT_VERSION, cs_main, CBufferedFile::eof(), CBufferedFile::FindByte(), FLATDATA, g_chainstate, CChainParams::GetConsensus(), CBufferedFile::GetPos(), GetTimeMillis(), Consensus::Params::hashGenesisBlock, CValidationState::IsError(), LOCK, LogPrint, LogPrintf, mapBlockIndex, MaxBlockSize(), CMessageHeader::MESSAGE_START_SIZE, CChainParams::MessageStart(), NotifyHeaderTip(), CDiskBlockPos::nPos, ReadBlockFromDisk(), BCLog::REINDEX, SER_DISK, CBufferedFile::SetLimit(), CBufferedFile::SetPos(), and base_blob< BITS >::ToString().
Referenced by ThreadImport().
◆ 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()
bool LoadMempool | ( | ) |
Load the mempool from disk.
Definition at line 4909 of file validation.cpp.
References AcceptToMemoryPoolWithTime(), CLIENT_VERSION, count, cs_main, DEFAULT_MEMPOOL_EXPIRY, CTxMemPool::exists(), fsbridge::fopen(), gArgs, ArgsManager::GetArg(), GetDataDir(), GetTime(), CAutoFile::IsNull(), CValidationState::IsValid(), LOCK, LogPrintf, mempool, MEMPOOL_DUMP_VERSION, Params(), CTxMemPool::PrioritiseTransaction(), SER_DISK, and ShutdownRequested().
Referenced by ThreadImport().
◆ NotifyHeaderTip()
|
static |
Definition at line 2954 of file validation.cpp.
References cs_main, GetMainSignals(), IsInitialBlockDownload(), LOCK, CClientUIInterface::NotifyHeaderTip, CMainSignals::NotifyHeaderTip(), pindexBestHeader, and uiInterface.
Referenced by LoadExternalBlockFile(), ProcessNewBlock(), and ProcessNewBlockHeaders().
◆ 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 |
Definition at line 4033 of file validation.cpp.
References fsbridge::fopen(), GetBlockPosFilename(), CDiskBlockPos::IsNull(), LogPrintf, CDiskBlockPos::nPos, and prefix.
Referenced by OpenBlockFile(), and OpenUndoFile().
◆ OpenUndoFile()
|
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] pblock The block we want to process. [in] fForceProcessing Process this block even if unrequested; used for non-network block sources and whitelisted peers. [out] fNewBlock A 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] block The block headers themselves [out] state This may be set to an Error state if any error occurred processing them [in] chainparams The params for the chain we want to connect to [out] ppindex If set, the pointer will be set to point to the last new block index object for the given headers [out] first_invalid First 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 | ) |
Mark one block file as pruned.
Definition at line 3886 of file validation.cpp.
References BLOCK_HAVE_DATA, BLOCK_HAVE_UNDO, LOCK, mapBlockIndex, CBlockIndex::nDataPos, CBlockIndex::nFile, CBlockIndex::nStatus, CBlockIndex::nUndoPos, and CBlockIndex::pprev.
Referenced by BOOST_FIXTURE_TEST_CASE(), FindFilesToPrune(), and FindFilesToPruneManual().
◆ ReadBlockFromDisk() [1/2]
bool ReadBlockFromDisk | ( | CBlock & | block, |
const CDiskBlockPos & | pos, | ||
const Consensus::Params & | consensusParams | ||
) |
Functions for disk access for blocks.
Definition at line 1043 of file validation.cpp.
References CheckProofOfWork(), CLIENT_VERSION, error(), CBlockHeader::GetHash(), CAutoFile::IsNull(), CBlockHeader::nBits, OpenBlockFile(), SER_DISK, CBlock::SetNull(), and CDiskBlockPos::ToString().
Referenced by BuildSimplifiedMNListDiff(), CChainState::ConnectTip(), CChainState::DisconnectTip(), GetBlockChecked(), llmq::CChainLocksHandler::GetBlockTxs(), getmerkleblocks(), GetTransaction(), gettxoutproof(), listsinceblock(), LoadExternalBlockFile(), CZMQPublishRawBlockNotifier::NotifyBlock(), CZMQPublishRawChainLockNotifier::NotifyChainLock(), CZMQPublishRawChainLockSigNotifier::NotifyChainLock(), ProcessGetBlockData(), ProcessMessage(), ReadBlockFromDisk(), CChainState::ReplayBlocks(), rest_block(), CChainState::RollforwardBlock(), CWallet::ScanForWalletTransactions(), PeerLogicValidation::SendMessages(), llmq::CQuorumBlockProcessor::UpgradeDB(), and CVerifyDB::VerifyDB().
◆ ReadBlockFromDisk() [2/2]
bool ReadBlockFromDisk | ( | CBlock & | block, |
const CBlockIndex * | pindex, | ||
const Consensus::Params & | consensusParams | ||
) |
Definition at line 1067 of file validation.cpp.
References cs_main, error(), CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockPos(), CBlockHeader::GetHash(), LOCK, ReadBlockFromDisk(), CDiskBlockPos::ToString(), and CBlockIndex::ToString().
◆ 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 |
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 | ||
) |
Check a block is completely valid from start to finish (only works on top of our current best block, with cs_main held)
Definition at line 3837 of file validation.cpp.
References AssertLockHeld(), chainActive, llmq::chainLocksHandler, CheckBlock(), CChainState::ConnectBlock(), ContextualCheckBlock(), ContextualCheckBlockHeader(), cs_main, CValidationState::DoS(), error(), evoDb, FormatStateMessage(), g_chainstate, GetAdjustedTime(), CChainParams::GetConsensus(), CBlockHeader::GetHash(), CValidationState::IsValid(), CBlockIndex::nHeight, pcoinsTip, REJECT_INVALID, and CChain::Tip().
Referenced by BlockAssembler::CreateNewBlock(), and getblocktemplate().
◆ 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()
void UnloadBlockIndex | ( | ) |
Unload database information.
Definition at line 4464 of file validation.cpp.
References chainActive, VersionBitsCache::Clear(), CTxMemPool::clear(), cs_main, fHavePruned, g_chainstate, LOCK, mapBlockIndex, mempool, pindexBestHeader, CChain::SetTip(), CChainState::UnloadBlockIndex(), VERSIONBITS_NUM_BITS, versionbitscache, and warningcache.
Referenced by AppInitMain().
◆ UpdateCoins() [1/2]
void UpdateCoins | ( | const CTransaction & | tx, |
CCoinsViewCache & | inputs, | ||
CTxUndo & | txundo, | ||
int | nHeight | ||
) |
Definition at line 1371 of file validation.cpp.
References AddCoins(), CTransaction::IsCoinBase(), CTxIn::prevout, CCoinsViewCache::SpendCoin(), CTransaction::vin, and CTxUndo::vprevout.
Referenced by CheckInputsAndUpdateCoins(), CChainState::ConnectBlock(), and UpdateCoins().
◆ 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()
void UpdateMempoolForReorg | ( | DisconnectedBlockTransactions & | disconnectpool, |
bool | fAddToMempool | ||
) |
Definition at line 546 of file validation.cpp.
References AcceptToMemoryPool(), AssertLockHeld(), chainActive, cs_main, DEFAULT_MAX_MEMPOOL_SIZE, DEFAULT_MEMPOOL_EXPIRY, CTxMemPool::exists(), gArgs, ArgsManager::GetArg(), LimitMempoolSize(), mempool, CBlockIndex::nHeight, pcoinsTip, DisconnectedBlockTransactions::queuedTx, CTxMemPool::removeForReorg(), CTxMemPool::removeRecursive(), REORG, STANDARD_LOCKTIME_VERIFY_FLAGS, CChain::Tip(), and CTxMemPool::UpdateTransactionsFromBlock().
Referenced by CChainState::ActivateBestChainStep(), and CChainState::InvalidateBlock().
◆ UpdateTip()
|
static |
Check warning conditions and do some notifications on new chain tip set.
Definition at line 2550 of file validation.cpp.
References _(), CTxMemPool::AddTransactionsUpdated(), ComputeBlockVersion(), DateTimeStrFormat(), DoWarning(), evoDb, g_best_block, g_best_block_cv, g_best_block_mutex, CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockTime(), CChainParams::GetConsensus(), base_uint< BITS >::getdouble(), AbstractThresholdConditionChecker::GetStateFor(), GuessVerificationProgress(), IsInitialBlockDownload(), LogPrintf, mempool, CBlockIndex::nChainTx, CBlockIndex::nChainWork, CBlockIndex::nHeight, CBlockIndex::nVersion, pcoinsTip, CBlockIndex::pprev, strprintf, THRESHOLD_ACTIVE, THRESHOLD_LOCKED_IN, base_blob< BITS >::ToString(), CChainParams::TxData(), VERSIONBITS_LAST_OLD_BLOCK_VERSION, VERSIONBITS_NUM_BITS, and warningcache.
Referenced by CChainState::ConnectTip(), and CChainState::DisconnectTip().
◆ 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 |
Definition at line 1022 of file validation.cpp.
References CLIENT_VERSION, error(), fileout, FLATDATA, GetSerializeSize(), CDiskBlockPos::nPos, OpenBlockFile(), and SER_DISK.
Referenced by SaveBlockToDisk().
◆ WriteTxIndexDataForBlock()
|
static |
Definition at line 1844 of file validation.cpp.
References CLIENT_VERSION, fTxIndex, CBlockIndex::GetBlockPos(), GetSerializeSize(), GetSizeOfCompactSize(), CDiskTxPos::nTxOffset, pblocktree, SER_DISK, and CBlock::vtx.
Referenced by CChainState::ConnectBlock().
◆ WriteUndoDataForBlock()
|
static |
Definition at line 1825 of file validation.cpp.
References BLOCK_HAVE_UNDO, CLIENT_VERSION, error(), FindUndoPos(), CBlockIndex::GetBlockHash(), GetSerializeSize(), CBlockIndex::GetUndoPos(), CDiskBlockPos::IsNull(), CChainParams::MessageStart(), CBlockIndex::nFile, CDiskBlockPos::nPos, CBlockIndex::nStatus, CBlockIndex::nUndoPos, CBlockIndex::pprev, and SER_DISK.
Referenced by CChainState::ConnectBlock().
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
CCriticalSection 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
bool fAddressIndex = false |
Definition at line 226 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), AppInitMain(), CChainState::ConnectBlock(), CChainState::DisconnectBlock(), GetAddressIndex(), GetAddressUnspent(), LoadBlockIndex(), and LoadBlockIndexDB().
◆ 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
std::atomic<bool> fDIP0001ActiveAtTip {false} |
Definition at line 240 of file validation.cpp.
Referenced by BlockAssembler::BlockAssembler(), getblocktemplate(), CConnman::OutboundTargetReached(), BlockAssembler::TestPackage(), and CDSNotificationInterface::UpdatedBlockTip().
◆ fDIP0003ActiveAtTip
std::atomic<bool> fDIP0003ActiveAtTip {false} |
Definition at line 241 of file validation.cpp.
◆ feeEstimator
CTxMemPool mempool & feeEstimator |
Definition at line 249 of file validation.cpp.
Referenced by AppInitMain(), CWallet::CreateTransaction(), CTransactionBuilder::CTransactionBuilder(), estimatefee(), estimaterawfee(), estimatesmartfee(), ParseConfirmTarget(), PrepareShutdown(), CoinControlDialog::updateLabels(), and SendCoinsDialog::updateSmartFeeLabel().
◆ 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
bool fPruneMode = false |
True if we're running in -prune mode.
Definition at line 230 of file validation.cpp.
Referenced by AppInitMain(), AppInitParameterInteraction(), CWallet::CreateWalletFromFile(), FindBlockPos(), FindFilesToPruneManual(), FindUndoPos(), FlushStateToDisk(), getblockchaininfo(), importaddress(), importelectrumwallet(), importprivkey(), importpubkey(), importwallet(), ProcessMessage(), pruneblockchain(), rescanblockchain(), llmq::CQuorumBlockProcessor::UpgradeDB(), and CVerifyDB::VerifyDB().
◆ fRequireStandard
bool fRequireStandard = true |
Definition at line 232 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), and AppInitParameterInteraction().
◆ fSpentIndex
bool fSpentIndex = false |
Definition at line 228 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), AppInitMain(), CChainState::ConnectBlock(), CChainState::DisconnectBlock(), GetSpentIndex(), LoadBlockIndex(), and LoadBlockIndexDB().
◆ fTimestampIndex
bool fTimestampIndex = false |
Definition at line 227 of file validation.cpp.
Referenced by AppInitMain(), CChainState::ConnectBlock(), GetTimestampIndex(), LoadBlockIndex(), and LoadBlockIndexDB().
◆ fTxIndex
bool fTxIndex = true |
Definition at line 225 of file validation.cpp.
Referenced by AlreadyHave(), AppInitMain(), getblockstats(), getrawtransaction(), GetTransaction(), LoadBlockIndex(), LoadBlockIndexDB(), and WriteTxIndexDataForBlock().
◆ 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
class CChainState g_chainstate |
Referenced by ActivateBestChain(), InvalidateBlock(), LoadBlockIndexDB(), LoadChainTip(), LoadExternalBlockFile(), LoadGenesisBlock(), PreciousBlock(), ProcessNewBlock(), ProcessNewBlockHeaders(), ReplayBlocks(), ResetBlockFailureFlags(), TestBlockValidity(), UnloadBlockIndex(), and CVerifyDB::VerifyDB().
◆ 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
CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE |
Absolute maximum transaction fee (in duffs) used by wallet and mempool (rejects high fee in sendrawtransaction)
Definition at line 247 of file validation.cpp.
Referenced by CPrivateSendServer::CommitFinalTransaction(), CWallet::CommitTransaction(), CTransactionBuilder::GetFee(), GetMinimumFee(), CPrivateSend::IsCollateralValid(), WalletInit::ParameterInteraction(), WalletModel::prepareTransaction(), SendCoinsDialog::processSendCoinsReturn(), CWallet::ReacceptWalletTransactions(), CWalletTx::RelayWalletTransaction(), CWallet::SelectCoinsMinConf(), and sendrawtransaction().
◆ MEMPOOL_DUMP_VERSION
|
static |
Definition at line 4907 of file validation.cpp.
Referenced by DumpMempool(), and LoadMempool().
◆ minRelayTxFee
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE) |
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
|
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 |
Definition at line 222 of file validation.cpp.
Referenced by AppInitMain(), AppInitParameterInteraction(), and CChainState::ConnectBlock().
◆ nTimeCallbacks
|
static |
Definition at line 1976 of file validation.cpp.
Referenced by CChainState::ConnectBlock().
◆ nTimeChainState
|
static |
Definition at line 2667 of file validation.cpp.
Referenced by CChainState::ConnectTip().
◆ nTimeCheck
|
static |
Definition at line 1965 of file validation.cpp.
Referenced by CChainState::ConnectBlock().
◆ nTimeConnect
|
static |
Definition at line 1974 of file validation.cpp.
Referenced by CChainState::ConnectBlock().
◆ nTimeConnectTotal
|
static |
Definition at line 2665 of file validation.cpp.
Referenced by CChainState::ConnectTip().
◆ nTimeDashSpecific
|
static |
Definition at line 1973 of file validation.cpp.
Referenced by CChainState::ConnectBlock().
◆ nTimeFlush
|
static |
Definition at line 2666 of file validation.cpp.
Referenced by CChainState::ConnectTip().
◆ nTimeForks
|
static |
Definition at line 1966 of file validation.cpp.
Referenced by CChainState::ConnectBlock().
◆ nTimeIndex
|
static |
Definition at line 1975 of file validation.cpp.
Referenced by CChainState::ConnectBlock().
◆ nTimeISFilter
|
static |
Definition at line 1968 of file validation.cpp.
Referenced by CChainState::ConnectBlock().
◆ nTimePayeeValid
|
static |
Definition at line 1971 of file validation.cpp.
Referenced by CChainState::ConnectBlock().
◆ nTimePostConnect
|
static |
Definition at line 2668 of file validation.cpp.
Referenced by CChainState::ConnectTip().
◆ nTimeProcessSpecial
|
static |
Definition at line 1972 of file validation.cpp.
Referenced by CChainState::ConnectBlock().
◆ nTimeReadFromDisk
|
static |
Definition at line 2664 of file validation.cpp.
Referenced by CChainState::ConnectTip().
◆ nTimeSubsidy
|
static |
Definition at line 1969 of file validation.cpp.
Referenced by CChainState::ConnectBlock().
◆ nTimeTotal
|
static |
Definition at line 1977 of file validation.cpp.
Referenced by CChainState::ConnectTip().
◆ nTimeValueValid
|
static |
Definition at line 1970 of file validation.cpp.
Referenced by CChainState::ConnectBlock().
◆ nTimeVerify
|
static |
Definition at line 1967 of file validation.cpp.
Referenced by CChainState::ConnectBlock().
◆ pblocktree
std::unique_ptr<CBlockTreeDB> pblocktree |
Global variable that points to the active block tree (protected by cs_main)
Definition at line 301 of file validation.cpp.
Referenced by AlreadyHave(), AppInitMain(), CChainState::ConnectBlock(), CChainState::DisconnectBlock(), FlushStateToDisk(), GetAddressIndex(), GetAddressUnspent(), GetSpentIndex(), GetTimestampIndex(), GetTransaction(), LoadBlockIndex(), LoadBlockIndexDB(), PrepareShutdown(), ThreadImport(), and WriteTxIndexDataForBlock().
◆ 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
std::unique_ptr<CCoinsViewCache> pcoinsTip |
Global variable that points to the active CCoinsView (protected by cs_main)
Definition at line 300 of file validation.cpp.
Referenced by AcceptToMemoryPoolWithTime(), AcceptToMemoryPoolWorker(), CChainState::ActivateBestChainStep(), AlreadyHave(), AppInitMain(), CheckInputsFromMempoolAndCache(), CheckSequenceLocks(), combinerawtransaction(), CChainState::ConnectTip(), CChainState::DisconnectTip(), FlushStateToDisk(), GetTransaction(), gettxout(), gettxoutproof(), GetUTXOCoin(), CPrivateSendBaseSession::IsValidInOuts(), LimitMempoolSize(), LoadChainTip(), PrepareShutdown(), ProcessMessage(), rest_getutxos(), sendrawtransaction(), signrawtransaction(), TestBlockValidity(), TransactionDesc::toHTML(), UpdateMempoolForReorg(), UpdateTip(), verifychain(), CVerifyDB::VerifyDB(), and while().
◆ pindexBestForkBase
CBlockIndex * pindexBestForkBase = nullptr |
Definition at line 1244 of file validation.cpp.
Referenced by CheckForkWarningConditions(), and CheckForkWarningConditionsOnNewFork().
◆ pindexBestForkTip
CBlockIndex* pindexBestForkTip = nullptr |
Definition at line 1244 of file validation.cpp.
Referenced by CheckForkWarningConditions(), and CheckForkWarningConditionsOnNewFork().
◆ pindexBestHeader
CBlockIndex* pindexBestHeader = nullptr |
Best header we've seen so far (used for getheaders queries' starting points).
Definition at line 218 of file validation.cpp.
Referenced by CChainState::AddToBlockIndex(), BlockRequestAllowed(), CChainState::ConnectBlock(), getblockchaininfo(), ClientModel::getHeaderTipHeight(), ClientModel::getHeaderTipTime(), CChainState::InvalidateBlock(), IsCurrentForFeeEstimation(), CChainState::LoadBlockIndex(), CMasternodeSync::NotifyHeaderTip(), NotifyHeaderTip(), ProcessGetBlockData(), ProcessHeadersMessage(), ProcessMessage(), PeerLogicValidation::SendMessages(), UnloadBlockIndex(), and CMasternodeSync::UpdatedBlockTip().
◆ scriptcheckqueue
|
static |
Referenced by CChainState::ConnectBlock(), and ThreadScriptCheck().
◆ scriptExecutionCache
|
static |
Definition at line 1406 of file validation.cpp.
Referenced by CheckInputs(), and InitScriptExecutionCache().
◆ scriptExecutionCacheNonce
|
static |
Referenced by CheckInputs().
◆ strMessageMagic
const std::string strMessageMagic = "DarkCoin Signed Message:\n" |
Definition at line 257 of file validation.cpp.
Referenced by CSporkMessage::GetSignerKeyID(), SignVerifyMessageDialog::on_signMessageButton_SM_clicked(), SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked(), CMessageSigner::SignMessage(), signmessage(), signmessagewithprivkey(), CMessageSigner::VerifyMessage(), and verifymessage().
◆ versionbitscache
VersionBitsCache versionbitscache |
Definition at line 1872 of file validation.cpp.
Referenced by llmq::CChainLocksHandler::CheckActiveState(), CheckCbTx(), ComputeBlockVersion(), CChainState::ConnectBlock(), ContextualCheckBlock(), BlockAssembler::CreateNewBlock(), GetBlockScriptFlags(), getblocktemplate(), CMasternodePayments::GetBlockTxOuts(), UnloadBlockIndex(), llmq::CInstantSendManager::UpdatedBlockTip(), VersionBitsTipState(), VersionBitsTipStateSinceHeight(), and VersionBitsTipStatistics().
◆ warningcache
|
static |
Definition at line 1929 of file validation.cpp.
Referenced by UnloadBlockIndex(), and UpdateTip().