Dash Core  0.12.2.1
P2P Digital Currency
validation.h File Reference
#include "amount.h"
#include "chain.h"
#include "coins.h"
#include "protocol.h"
#include "script/script_error.h"
#include "sync.h"
#include "versionbits.h"
#include "spentindex.h"
#include <algorithm>
#include <exception>
#include <map>
#include <set>
#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
#include <atomic>
#include <boost/unordered_map.hpp>
#include <boost/filesystem/path.hpp>

Go to the source code of this file.

Classes

struct  BlockHasher
 
struct  CTimestampIndexIteratorKey
 
struct  CTimestampIndexKey
 
struct  CAddressUnspentKey
 
struct  CAddressUnspentValue
 
struct  CAddressIndexKey
 
struct  CAddressIndexIteratorKey
 
struct  CAddressIndexIteratorHeightKey
 
struct  CDiskTxPos
 
class  CScriptCheck
 
class  CBlockFileInfo
 
class  CVerifyDB
 

Typedefs

typedef boost::unordered_map< uint256, CBlockIndex *, BlockHasherBlockMap
 

Functions

bool ProcessNewBlock (const CChainParams &chainparams, const CBlock *pblock, bool fForceProcessing, const CDiskBlockPos *dbp, bool *fNewBlock)
 
bool ProcessNewBlockHeaders (const std::vector< CBlockHeader > &block, CValidationState &state, const CChainParams &chainparams, CBlockIndex **ppindex=NULL)
 
bool CheckDiskSpace (uint64_t nAdditionalBytes=0)
 
FILE * OpenBlockFile (const CDiskBlockPos &pos, bool fReadOnly=false)
 
FILE * OpenUndoFile (const CDiskBlockPos &pos, bool fReadOnly=false)
 
boost::filesystem::path GetBlockPosFilename (const CDiskBlockPos &pos, const char *prefix)
 
bool LoadExternalBlockFile (const CChainParams &chainparams, FILE *fileIn, CDiskBlockPos *dbp=NULL)
 
bool InitBlockIndex (const CChainParams &chainparams)
 
bool LoadBlockIndex ()
 
void UnloadBlockIndex ()
 
void ThreadScriptCheck ()
 
bool IsInitialBlockDownload ()
 
std::string GetWarnings (const std::string &strFor)
 
bool GetTransaction (const uint256 &hash, CTransaction &tx, const Consensus::Params &params, uint256 &hashBlock, bool fAllowSlow=false)
 
bool ActivateBestChain (CValidationState &state, const CChainParams &chainparams, const CBlock *pblock=NULL)
 
double ConvertBitsToDouble (unsigned int nBits)
 
CAmount GetBlockSubsidy (int nBits, int nHeight, const Consensus::Params &consensusParams, bool fSuperblockPartOnly=false)
 
CAmount GetMasternodePayment (int nHeight, CAmount blockValue)
 
void FindFilesToPrune (std::set< int > &setFilesToPrune, uint64_t nPruneAfterHeight)
 
void UnlinkPrunedFiles (std::set< int > &setFilesToPrune)
 
CBlockIndexInsertBlockIndex (uint256 hash)
 
void FlushStateToDisk ()
 
void PruneAndFlush ()
 
bool AcceptToMemoryPool (CTxMemPool &pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, bool *pfMissingInputs, bool fOverrideMempoolLimit=false, bool fRejectAbsurdFee=false, bool fDryRun=false)
 
bool GetUTXOCoins (const COutPoint &outpoint, CCoins &coins)
 
int GetUTXOHeight (const COutPoint &outpoint)
 
int GetUTXOConfirmations (const COutPoint &outpoint)
 
std::string FormatStateMessage (const CValidationState &state)
 
ThresholdState VersionBitsTipState (const Consensus::Params &params, Consensus::DeploymentPos pos)
 
unsigned int GetLegacySigOpCount (const CTransaction &tx)
 
unsigned int GetP2SHSigOpCount (const CTransaction &tx, const CCoinsViewCache &mapInputs)
 
bool CheckInputs (const CTransaction &tx, CValidationState &state, const CCoinsViewCache &view, bool fScriptChecks, unsigned int flags, bool cacheStore, std::vector< CScriptCheck > *pvChecks=NULL)
 
void UpdateCoins (const CTransaction &tx, CValidationState &state, CCoinsViewCache &inputs, int nHeight)
 
bool CheckTransaction (const CTransaction &tx, CValidationState &state)
 
bool IsFinalTx (const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
 
bool CheckFinalTx (const CTransaction &tx, int flags=-1)
 
bool TestLockPointValidity (const LockPoints *lp)
 
bool SequenceLocks (const CTransaction &tx, int flags, std::vector< int > *prevHeights, const CBlockIndex &block)
 
bool CheckSequenceLocks (const CTransaction &tx, int flags, LockPoints *lp=NULL, bool useExistingLockPoints=false)
 
bool GetTimestampIndex (const unsigned int &high, const unsigned int &low, std::vector< uint256 > &hashes)
 
bool GetSpentIndex (CSpentIndexKey &key, CSpentIndexValue &value)
 
bool GetAddressIndex (uint160 addressHash, int type, std::vector< std::pair< CAddressIndexKey, CAmount > > &addressIndex, int start=0, int end=0)
 
bool GetAddressUnspent (uint160 addressHash, int type, std::vector< std::pair< CAddressUnspentKey, CAddressUnspentValue > > &unspentOutputs)
 
bool WriteBlockToDisk (const CBlock &block, CDiskBlockPos &pos, const CMessageHeader::MessageStartChars &messageStart)
 
bool ReadBlockFromDisk (CBlock &block, const CDiskBlockPos &pos, const Consensus::Params &consensusParams)
 
bool ReadBlockFromDisk (CBlock &block, const CBlockIndex *pindex, const Consensus::Params &consensusParams)
 
bool DisconnectBlock (const CBlock &block, CValidationState &state, const CBlockIndex *pindex, CCoinsViewCache &coins, bool *pfClean=NULL)
 
bool DisconnectBlocks (int blocks)
 
void ReprocessBlocks (int nBlocks)
 
bool ConnectBlock (const CBlock &block, CValidationState &state, CBlockIndex *pindex, CCoinsViewCache &coins, bool fJustCheck=false)
 
bool CheckBlockHeader (const CBlockHeader &block, CValidationState &state, bool fCheckPOW=true)
 
bool CheckBlock (const CBlock &block, CValidationState &state, bool fCheckPOW=true, bool fCheckMerkleRoot=true)
 
bool ContextualCheckBlockHeader (const CBlockHeader &block, CValidationState &state, CBlockIndex *pindexPrev)
 
bool ContextualCheckBlock (const CBlock &block, CValidationState &state, CBlockIndex *pindexPrev)
 
bool TestBlockValidity (CValidationState &state, const CChainParams &chainparams, const CBlock &block, CBlockIndex *pindexPrev, bool fCheckPOW=true, bool fCheckMerkleRoot=true)
 
CBlockIndexFindForkInGlobalIndex (const CChain &chain, const CBlockLocator &locator)
 
bool InvalidateBlock (CValidationState &state, const Consensus::Params &consensusParams, CBlockIndex *pindex)
 
bool ReconsiderBlock (CValidationState &state, CBlockIndex *pindex)
 
int GetSpendHeight (const CCoinsViewCache &inputs)
 
int32_t ComputeBlockVersion (const CBlockIndex *pindexPrev, const Consensus::Params &params, bool fAssumeMasternodeIsUpgraded=false)
 
bool GetBlockHash (uint256 &hashRet, int nBlockHeight=-1)
 

Variables

static const bool DEFAULT_ALERTS = true
 
static const bool DEFAULT_WHITELISTRELAY = true
 
static const bool DEFAULT_WHITELISTFORCERELAY = true
 
static const unsigned int DEFAULT_LEGACY_MIN_RELAY_TX_FEE = 10000
 
static const unsigned int DEFAULT_DIP0001_MIN_RELAY_TX_FEE = 1000
 
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100
 
static const unsigned int DEFAULT_ANCESTOR_LIMIT = 25
 
static const unsigned int DEFAULT_ANCESTOR_SIZE_LIMIT = 101
 
static const unsigned int DEFAULT_DESCENDANT_LIMIT = 25
 
static const unsigned int DEFAULT_DESCENDANT_SIZE_LIMIT = 101
 
static const unsigned int DEFAULT_MEMPOOL_EXPIRY = 72
 
static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000
 
static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000
 
static const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000
 
static const int MAX_SCRIPTCHECK_THREADS = 16
 
static const int DEFAULT_SCRIPTCHECK_THREADS = 0
 
static const int MAX_BLOCKS_IN_TRANSIT_PER_PEER = 16
 
static const unsigned int BLOCK_STALLING_TIMEOUT = 2
 
static const unsigned int MAX_HEADERS_RESULTS = 2000
 
static const unsigned int BLOCK_DOWNLOAD_WINDOW = 1024
 
static const unsigned int DATABASE_WRITE_INTERVAL = 60 * 60
 
static const unsigned int DATABASE_FLUSH_INTERVAL = 24 * 60 * 60
 
static const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111
 
static const unsigned int AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL = 24 * 24 * 60
 
static const unsigned int AVG_ADDRESS_BROADCAST_INTERVAL = 30
 
static const unsigned int AVG_INVENTORY_BROADCAST_INTERVAL = 5
 
static const int64_t BLOCK_DOWNLOAD_TIMEOUT_BASE = 250000
 
static const int64_t BLOCK_DOWNLOAD_TIMEOUT_PER_PEER = 125000
 
static const unsigned int DEFAULT_LIMITFREERELAY = 15
 
static const bool DEFAULT_RELAYPRIORITY = true
 
static const bool DEFAULT_PERMIT_BAREMULTISIG = true
 
static const unsigned int DEFAULT_BYTES_PER_SIGOP = 20
 
static const bool DEFAULT_CHECKPOINTS_ENABLED = true
 
static const bool DEFAULT_TXINDEX = true
 
static const bool DEFAULT_ADDRESSINDEX = false
 
static const bool DEFAULT_TIMESTAMPINDEX = false
 
static const bool DEFAULT_SPENTINDEX = false
 
static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100
 
static const bool DEFAULT_TESTSAFEMODE = false
 
static const bool DEFAULT_ENABLE_REPLACEMENT = false
 
static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8
 
CScript COINBASE_FLAGS
 
CCriticalSection cs_main
 
CTxMemPool mempool
 
BlockMap mapBlockIndex
 
uint64_t nLastBlockTx
 
uint64_t nLastBlockSize
 
const std::string strMessageMagic
 
CWaitableCriticalSection csBestBlock
 
CConditionVariable cvBlockChange
 
bool fImporting
 
bool fReindex
 
int nScriptCheckThreads
 
bool fTxIndex
 
bool fIsBareMultisigStd
 
bool fRequireStandard
 
unsigned int nBytesPerSigOp
 
bool fCheckBlockIndex
 
bool fCheckpointsEnabled
 
size_t nCoinCacheUsage
 
CFeeRate minRelayTxFee
 
bool fAlerts
 
bool fEnableReplacement
 
std::map< uint256, int64_t > mapRejectedBlocks
 
static const int DIP0001_PROTOCOL_VERSION = 70208
 
std::atomic< bool > fDIP0001WasLockedIn
 
std::atomic< bool > fDIP0001ActiveAtTip
 
uint256 hashAssumeValid
 
CBlockIndexpindexBestHeader
 
static const uint64_t nMinDiskSpace = 52428800
 
bool fHavePruned
 
bool fPruneMode
 
uint64_t nPruneTarget
 
static const unsigned int MIN_BLOCKS_TO_KEEP = 288
 
static const signed int DEFAULT_CHECKBLOCKS = MIN_BLOCKS_TO_KEEP
 
static const unsigned int DEFAULT_CHECKLEVEL = 3
 
static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 945 * 1024 * 1024
 
CChain chainActive
 
CCoinsViewCachepcoinsTip
 
CBlockTreeDBpblocktree
 
VersionBitsCache versionbitscache
 
static const unsigned int REJECT_INTERNAL = 0x100
 
static const unsigned int REJECT_HIGHFEE = 0x100
 
static const unsigned int REJECT_ALREADY_KNOWN = 0x101
 
static const unsigned int REJECT_CONFLICT = 0x102
 

Typedef Documentation

◆ BlockMap

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

Definition at line 144 of file validation.h.

Function Documentation

◆ AcceptToMemoryPool()

bool AcceptToMemoryPool ( CTxMemPool pool,
CValidationState state,
const CTransaction tx,
bool  fLimitFree,
bool *  pfMissingInputs,
bool  fOverrideMempoolLimit = false,
bool  fRejectAbsurdFee = false,
bool  fDryRun = false 
)

◆ ActivateBestChain()

bool ActivateBestChain ( CValidationState state,
const CChainParams chainparams,
const CBlock pblock 
)

Find the best known block, and make it the tip of the block chain

Make the best chain active, in multiple steps. The result is either failure or an activated best chain. pblock is either NULL or a pointer to a block that is already loaded (to avoid loading it again from disk).

Definition at line 2808 of file validation.cpp.

Referenced by InitBlockIndex(), invalidateblock(), LoadExternalBlockFile(), ProcessNewBlock(), reconsiderblock(), ReprocessBlocks(), and ThreadImport().

◆ CheckBlock()

bool CheckBlock ( const CBlock block,
CValidationState state,
bool  fCheckPOW = true,
bool  fCheckMerkleRoot = true 
)

Definition at line 3119 of file validation.cpp.

Referenced by AcceptBlock(), ConnectBlock(), TestBlockValidity(), and CVerifyDB::VerifyDB().

◆ CheckBlockHeader()

bool CheckBlockHeader ( const CBlockHeader block,
CValidationState state,
bool  fCheckPOW = true 
)

Context-independent validity checks

Definition at line 3104 of file validation.cpp.

Referenced by AcceptBlockHeader(), and CheckBlock().

◆ CheckDiskSpace()

bool CheckDiskSpace ( uint64_t  nAdditionalBytes = 0)

Check whether enough disk space is available for an incoming block

Definition at line 3642 of file validation.cpp.

Referenced by AppInit2(), FindBlockPos(), FindUndoPos(), FlushStateToDisk(), and CPrivateSendClient::SendDenominate().

◆ CheckFinalTx()

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

◆ CheckInputs()

bool CheckInputs ( const CTransaction tx,
CValidationState state,
const CCoinsViewCache view,
bool  fScriptChecks,
unsigned int  flags,
bool  cacheStore,
std::vector< CScriptCheck > *  pvChecks = NULL 
)

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 NULL, script checks are pushed onto it instead of being performed inline.

Definition at line 1528 of file validation.cpp.

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

◆ CheckSequenceLocks()

bool CheckSequenceLocks ( const CTransaction tx,
int  flags,
LockPoints lp = NULL,
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 346 of file validation.cpp.

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

◆ CheckTransaction()

bool CheckTransaction ( const CTransaction tx,
CValidationState state 
)

Context-independent validity checks

Definition at line 470 of file validation.cpp.

Referenced by AcceptToMemoryPoolWorker(), CheckBlock(), and ReadKeyValue().

◆ ComputeBlockVersion()

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

Determine what nVersion a new block should use.

Definition at line 1878 of file validation.cpp.

Referenced by WarningBitsConditionChecker::Condition(), CreateNewBlock(), and UpdateTip().

◆ ConnectBlock()

bool ConnectBlock ( const CBlock block,
CValidationState state,
CBlockIndex pindex,
CCoinsViewCache coins,
bool  fJustCheck = false 
)

Apply the effects of this block (with given index) on the UTXO set represented by coins

Definition at line 1956 of file validation.cpp.

Referenced by ConnectTip(), TestBlockValidity(), and CVerifyDB::VerifyDB().

◆ ContextualCheckBlock()

bool ContextualCheckBlock ( const CBlock block,
CValidationState state,
CBlockIndex pindexPrev 
)

Definition at line 3275 of file validation.cpp.

Referenced by AcceptBlock(), and TestBlockValidity().

◆ ContextualCheckBlockHeader()

bool ContextualCheckBlockHeader ( const CBlockHeader block,
CValidationState state,
CBlockIndex pindexPrev 
)

Context-dependent validity checks

Definition at line 3232 of file validation.cpp.

Referenced by AcceptBlockHeader(), and TestBlockValidity().

◆ ConvertBitsToDouble()

double ConvertBitsToDouble ( unsigned int  nBits)

Definition at line 1205 of file validation.cpp.

Referenced by ContextualCheckBlockHeader(), and GetBlockSubsidy().

◆ DisconnectBlock()

bool DisconnectBlock ( const CBlock block,
CValidationState state,
const CBlockIndex pindex,
CCoinsViewCache coins,
bool *  pfClean = NULL 
)

Functions for validating blocks and updating the block tree Undo the effects of this block (with given index) on the UTXO set represented by coins. In case pfClean is provided, operation will try to be tolerant about errors, and *pfClean will be true if no problems were found. Otherwise, the return value will be false in case of problems. Note that in any case, coins may be modified.

Definition at line 1696 of file validation.cpp.

Referenced by DisconnectTip(), and CVerifyDB::VerifyDB().

◆ DisconnectBlocks()

bool DisconnectBlocks ( int  blocks)

Reprocess a number of blocks to try and get on the correct chain again

Definition at line 2591 of file validation.cpp.

Referenced by ReprocessBlocks().

◆ FindFilesToPrune()

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

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

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

Definition at line 3595 of file validation.cpp.

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

Referenced by AppInit2(), and ProcessMessage().

◆ FlushStateToDisk()

void FlushStateToDisk ( )

Flush all state, indexes and buffers to disk.

Definition at line 2408 of file validation.cpp.

◆ FormatStateMessage()

std::string FormatStateMessage ( const CValidationState state)

Convert CValidationState to a human-readable message for logging

Definition at line 541 of file validation.cpp.

Referenced by AcceptToMemoryPoolWorker(), CheckBlock(), ConnectBlock(), CreateNewBlock(), and ProcessMessage().

◆ GetAddressIndex()

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

Definition at line 1055 of file validation.cpp.

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

◆ GetAddressUnspent()

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

Definition at line 1067 of file validation.cpp.

Referenced by getaddressutxos().

◆ GetBlockHash()

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

◆ GetBlockPosFilename()

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

Translation to a filesystem path

Definition at line 3684 of file validation.cpp.

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

◆ GetBlockSubsidy()

CAmount GetBlockSubsidy ( int  nBits,
int  nHeight,
const Consensus::Params consensusParams,
bool  fSuperblockPartOnly = false 
)

Definition at line 1230 of file validation.cpp.

Referenced by ConnectBlock(), CreateNewBlock(), and CSuperblock::GetPaymentsLimit().

◆ GetLegacySigOpCount()

unsigned int GetLegacySigOpCount ( const CTransaction tx)

Count ECDSA signature operations the old-fashioned (pre-0.6) way

Returns
number of sigops this transaction's outputs will produce when spent
See also
CTransaction::FetchInputs

Definition at line 417 of file validation.cpp.

Referenced by AcceptToMemoryPoolWorker(), CheckBlock(), ConnectBlock(), ContextualCheckBlock(), and CreateNewBlock().

◆ GetMasternodePayment()

CAmount GetMasternodePayment ( int  nHeight,
CAmount  blockValue 
)

◆ GetP2SHSigOpCount()

unsigned int GetP2SHSigOpCount ( const CTransaction tx,
const CCoinsViewCache mapInputs 
)

Count ECDSA signature operations in pay-to-script-hash inputs.

Parameters
[in]mapInputsMap of previous transactions that have outputs we're spending
Returns
maximum number of sigops required to validate this transaction's inputs
See also
CTransaction::FetchInputs

Definition at line 431 of file validation.cpp.

Referenced by AcceptToMemoryPoolWorker(), and ConnectBlock().

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

Referenced by CheckInputs().

◆ GetSpentIndex()

bool GetSpentIndex ( CSpentIndexKey key,
CSpentIndexValue value 
)

Definition at line 1041 of file validation.cpp.

Referenced by getspentinfo(), and TxToJSON().

◆ GetTimestampIndex()

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

Definition at line 1030 of file validation.cpp.

Referenced by getblockhashes().

◆ GetTransaction()

bool GetTransaction ( const uint256 hash,
CTransaction txOut,
const Consensus::Params consensusParams,
uint256 hashBlock,
bool  fAllowSlow 
)

Retrieve a transaction (from memory pool, or from disk, if possible)

Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock

Definition at line 1080 of file validation.cpp.

Referenced by CMasternodeBroadcast::CheckOutpoint(), getrawtransaction(), gettxoutproof(), CGovernanceObject::IsCollateralValid(), CMasternode::IsInputAssociatedWithPubkey(), CInstantSend::ResolveConflicts(), and rest_tx().

◆ GetUTXOCoins()

◆ GetUTXOConfirmations()

int GetUTXOConfirmations ( const COutPoint outpoint)

◆ GetUTXOHeight()

int GetUTXOHeight ( const COutPoint outpoint)

◆ GetWarnings()

std::string GetWarnings ( const std::string &  strFor)

Format a string that describes several potential problems detected by the core. strFor can have three values:

  • "rpc": get critical warnings, which should put the client in safe mode if non-empty
  • "statusbar": get all warnings
  • "gui": get all warnings, translated (where possible) for GUI This function only returns the highest priority warning of the set selected by strFor.

Definition at line 4313 of file validation.cpp.

Referenced by getinfo(), getmininginfo(), getnetworkinfo(), ClientModel::getStatusBarWarnings(), and OnRPCPreCommand().

◆ InitBlockIndex()

bool InitBlockIndex ( const CChainParams chainparams)

Initialize a new block tree database + block data on disk

Definition at line 3956 of file validation.cpp.

Referenced by AppInit2(), and ThreadImport().

◆ InsertBlockIndex()

CBlockIndex* InsertBlockIndex ( uint256  hash)

Create a new block index entry for a given block hash

Definition at line 3689 of file validation.cpp.

Referenced by CBlockTreeDB::LoadBlockIndexGuts().

◆ InvalidateBlock()

bool InvalidateBlock ( CValidationState state,
const Consensus::Params consensusParams,
CBlockIndex pindex 
)

Mark a block as invalid.

Definition at line 2863 of file validation.cpp.

Referenced by invalidateblock().

◆ IsFinalTx()

bool IsFinalTx ( const CTransaction tx,
int  nBlockHeight,
int64_t  nBlockTime 
)

Check if transaction is final and can be included in a block with the specified height and time. Consensus critical.

Definition at line 200 of file validation.cpp.

Referenced by CheckFinalTx(), ContextualCheckBlock(), and CreateNewBlock().

◆ IsInitialBlockDownload()

◆ LoadBlockIndex()

bool LoadBlockIndex ( )

Load the block tree and coins database from disk

Definition at line 3948 of file validation.cpp.

Referenced by AppInit2().

◆ LoadExternalBlockFile()

bool LoadExternalBlockFile ( const CChainParams chainparams,
FILE *  fileIn,
CDiskBlockPos dbp = NULL 
)

Import blocks from an external file

Definition at line 4008 of file validation.cpp.

Referenced by ThreadImport().

◆ OpenBlockFile()

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

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

Definition at line 3676 of file validation.cpp.

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

◆ OpenUndoFile()

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

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

Definition at line 3680 of file validation.cpp.

Referenced by FindUndoPos(), and FlushBlockFile().

◆ ProcessNewBlock()

bool ProcessNewBlock ( const CChainParams chainparams,
const CBlock pblock,
bool  fForceProcessing,
const CDiskBlockPos dbp,
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.

Parameters
[in]pblockThe block we want to process.
[in]fForceProcessingProcess this block even if unrequested; used for non-network block sources and whitelisted peers.
[out]dbpThe already known disk position of pblock, or NULL if not yet stored.
[out]fNewBlockA boolean which is set to indicate if the block was first received via this call
Returns
True if state.IsValid()

Definition at line 3484 of file validation.cpp.

Referenced by generate(), ProcessBlockFound(), ProcessMessage(), and submitblock().

◆ ProcessNewBlockHeaders()

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

Process incoming block headers.

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

Definition at line 3385 of file validation.cpp.

Referenced by ProcessMessage().

◆ PruneAndFlush()

void PruneAndFlush ( )

Prune block files and flush state to disk.

Definition at line 2413 of file validation.cpp.

Referenced by AppInit2().

◆ ReadBlockFromDisk() [1/2]

◆ ReadBlockFromDisk() [2/2]

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

Definition at line 1195 of file validation.cpp.

◆ ReconsiderBlock()

bool ReconsiderBlock ( CValidationState state,
CBlockIndex pindex 
)

Remove invalidity status from a block and its descendants.

Definition at line 2903 of file validation.cpp.

Referenced by reconsiderblock(), and ReprocessBlocks().

◆ ReprocessBlocks()

void ReprocessBlocks ( int  nBlocks)

Definition at line 2608 of file validation.cpp.

Referenced by CSporkManager::ExecuteSpork().

◆ SequenceLocks()

bool SequenceLocks ( const CTransaction tx,
int  flags,
std::vector< int > *  prevHeights,
const CBlockIndex block 
)

Check if transaction is final per BIP 68 sequence numbers and can be included in a block. Consensus critical. Takes as input a list of heights at which tx's inputs (in order) confirmed.

Definition at line 323 of file validation.cpp.

Referenced by ConnectBlock().

◆ TestBlockValidity()

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

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

Definition at line 3511 of file validation.cpp.

Referenced by 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 328 of file validation.cpp.

Referenced by CTxMemPool::removeForReorg().

◆ ThreadScriptCheck()

void ThreadScriptCheck ( )

Run an instance of the script checking thread

Definition at line 1870 of file validation.cpp.

Referenced by AppInit2().

◆ UnlinkPrunedFiles()

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

Actually unlink the specified files

Definition at line 3584 of file validation.cpp.

Referenced by FlushStateToDisk().

◆ UnloadBlockIndex()

void UnloadBlockIndex ( )

Unload database information

Definition at line 3922 of file validation.cpp.

Referenced by AppInit2().

◆ UpdateCoins()

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

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

Definition at line 1461 of file validation.cpp.

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

Referenced by AcceptToMemoryPoolWorker(), and BIP9SoftForkDesc().

◆ WriteBlockToDisk()

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

Functions for disk access for blocks

Definition at line 1150 of file validation.cpp.

Referenced by AcceptBlock(), and InitBlockIndex().

Variable Documentation

◆ AVG_ADDRESS_BROADCAST_INTERVAL

const unsigned int AVG_ADDRESS_BROADCAST_INTERVAL = 30
static

Average delay between peer address broadcasts in seconds.

Definition at line 107 of file validation.h.

Referenced by SendMessages().

◆ AVG_INVENTORY_BROADCAST_INTERVAL

const unsigned int AVG_INVENTORY_BROADCAST_INTERVAL = 5
static

Average delay between trickled inventory broadcasts in seconds. Blocks, whitelisted receivers, and a random 25% of transactions bypass this.

Definition at line 110 of file validation.h.

Referenced by SendMessages().

◆ AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL

const unsigned int AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL = 24 * 24 * 60
static

Average delay between local address broadcasts in seconds.

Definition at line 105 of file validation.h.

Referenced by SendMessages().

◆ BLOCK_DOWNLOAD_TIMEOUT_BASE

const int64_t BLOCK_DOWNLOAD_TIMEOUT_BASE = 250000
static

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

Definition at line 112 of file validation.h.

Referenced by SendMessages().

◆ BLOCK_DOWNLOAD_TIMEOUT_PER_PEER

const int64_t BLOCK_DOWNLOAD_TIMEOUT_PER_PEER = 125000
static

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

Definition at line 114 of file validation.h.

Referenced by SendMessages().

◆ BLOCK_DOWNLOAD_WINDOW

const unsigned int BLOCK_DOWNLOAD_WINDOW = 1024
static

Size of the "block download window": how far ahead of our current height do we fetch? Larger windows tolerate larger download speed differences between peer, but increase the potential degree of disordering of blocks on disk (which make reindexing and in the future perhaps pruning harder). We'll probably want to make this a per-peer adaptive value at some point.

Definition at line 97 of file validation.h.

◆ BLOCK_STALLING_TIMEOUT

const unsigned int BLOCK_STALLING_TIMEOUT = 2
static

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

Definition at line 89 of file validation.h.

Referenced by SendMessages().

◆ BLOCKFILE_CHUNK_SIZE

const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000
static

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

Definition at line 78 of file validation.h.

Referenced by FindBlockPos(), and FindFilesToPrune().

◆ chainActive

CChain chainActive

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

Definition at line 65 of file validation.cpp.

Referenced by AcceptBlock(), AcceptToMemoryPoolWorker(), ActivateBestChain(), ActivateBestChainStep(), AlreadyHave(), AppInit2(), BitcoinMiner(), blockheaderToJSON(), blockToJSON(), CMasternode::Check(), CMasternodePing::CheckAndUpdate(), CheckBlockIndex(), CheckFinalTx(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), CMasternodeBroadcast::CheckOutpoint(), CheckSequenceLocks(), CMasternodePing::CMasternodePing(), ConnectTip(), CreateNewBlock(), CWallet::CreateTransaction(), DisconnectTip(), dumpwallet(), FindFilesToPrune(), FindMostWorkChain(), FlushStateToDisk(), TransactionDesc::FormatTxStatus(), generate(), getbestblockhash(), getblockchaininfo(), getblockcount(), getblockhash(), GetBlockHash(), getblockheaders(), getblocktemplate(), getchaintips(), CMerkleTx::GetDepthInMainChain(), GetDifficulty(), getgovernanceinfo(), getinfo(), CWallet::GetKeyBirthTimes(), ClientModel::getLastBlockDate(), getmininginfo(), GetNetworkHashPS(), ClientModel::getNumBlocks(), GetTransaction(), gettxoutproof(), GetUTXOConfirmations(), ClientModel::getVerificationProgress(), importaddress(), importelectrumwallet(), importprivkey(), importpubkey(), importwallet(), InitBlockIndex(), CDSNotificationInterface::InitializeCurrentBlockTip(), InvalidateBlock(), InvalidChainFound(), CGovernanceObject::IsCollateralValid(), IsInitialBlockDownload(), CTxLockRequest::IsValid(), listsinceblock(), LoadBlockIndexDB(), CActiveMasternode::ManageStateLocal(), CWallet::MarkConflicted(), masternode(), masternodelist(), mempoolToJSON(), WalletModel::pollBalanceChanged(), ProcessBlockFound(), ProcessGetData(), ProcessMessage(), CSporkManager::ProcessSpork(), PruneBlockIndexCandidates(), ReceivedBlockTransactions(), ReconsiderBlock(), CMasternodePayments::RequestLowDataPaymentBlocks(), rest_getutxos(), rest_headers(), CWallet::ScanForWalletTransactions(), SendMessages(), CMerkleTx::SetMerkleBranch(), TransactionRecord::statusUpdateNeeded(), TestBlockValidity(), TestLockPointValidity(), TxToJSON(), UnloadBlockIndex(), TransactionRecord::updateStatus(), UpdateTip(), CVerifyDB::VerifyDB(), verifytxoutproof(), and VersionBitsTipState().

◆ COINBASE_FLAGS

CScript COINBASE_FLAGS

Constant stuff for coinbase transactions we create:

Definition at line 107 of file validation.cpp.

Referenced by getblocktemplate(), and IncrementExtraNonce().

◆ cs_main

Global state

Definition at line 62 of file validation.cpp.

Referenced by WalletModel::abandonTransaction(), CWallet::AbandonTransaction(), abandontransaction(), AcceptBlock(), AcceptBlockHeader(), AcceptToMemoryPoolWorker(), ActivateBestChain(), ActivateBestChainStep(), CGovernanceManager::AddGovernanceObject(), addmultisigaddress(), AppInit2(), AutoBackupWallet(), CWallet::AvailableCoins(), backupwallet(), PeerLogicValidation::BlockChecked(), CPrivateSendServer::ChargeFees(), CPrivateSendServer::ChargeRandomFees(), CMasternode::Check(), CMasternodeMan::CheckAndRemove(), CMasternodePing::CheckAndUpdate(), CheckBlock(), CheckBlockIndex(), CMasternode::CheckCollateral(), CheckFinalTx(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), CGovernanceManager::CheckMasternodeOrphanObjects(), CGovernanceManager::CheckMasternodeOrphanVotes(), CMasternodeMan::CheckMnbAndUpdateMasternodeList(), CMasternodeBroadcast::CheckOutpoint(), CGovernanceManager::CheckPostponedObjects(), CheckSequenceLocks(), CMasternodePing::CMasternodePing(), CPrivateSendServer::CommitFinalTransaction(), CWallet::CommitTransaction(), ComputeBlockVersion(), ConnectBlock(), CWallet::CountInputsWithAmount(), CPrivateSendClient::CreateDenominated(), CreateNewBlock(), createrawtransaction(), CWallet::CreateTransaction(), decoderawtransaction(), TransactionTablePriv::describe(), DisconnectBlocks(), CMasternodeMan::DoFullVerificationStep(), dumpprivkey(), dumpwallet(), encryptwallet(), FindFilesToPrune(), FlushStateToDisk(), TransactionDesc::FormatTxStatus(), generate(), getaccount(), getaccountaddress(), getaddressesbyaccount(), CWallet::GetAllReserveKeys(), CWallet::GetAnonymizedBalance(), CWallet::GetAverageAnonymizedRounds(), getbalance(), CWallet::GetBalance(), getbestblockhash(), getblock(), getblockchaininfo(), getblockcount(), getblockhash(), GetBlockHash(), getblockheader(), getblockheaders(), getblocktemplate(), getchaintips(), CWallet::GetDenominatedBalance(), CMerkleTx::GetDepthInMainChain(), getdifficulty(), getgenerate(), getgovernanceinfo(), ClientModel::getHeaderTipHeight(), ClientModel::getHeaderTipTime(), CWallet::GetImmatureBalance(), CWallet::GetImmatureWatchOnlyBalance(), getinfo(), ClientModel::getLastBlockDate(), getmininginfo(), getnetworkhashps(), getnetworkinfo(), getnewaddress(), CMasternodeMan::GetNextMasternodeInQueueForPayment(), GetNodeStateStats(), CWallet::GetNormalizedAnonymizedBalance(), ClientModel::getNumBlocks(), WalletModel::getOutputs(), getrawchangeaddress(), getrawtransaction(), getreceivedbyaccount(), getreceivedbyaddress(), GetSpendHeight(), CCoinsViewDB::GetStats(), GetTransaction(), gettransaction(), TransactionTablePriv::getTxHex(), gettxout(), gettxoutproof(), getunconfirmedbalance(), CWallet::GetUnconfirmedBalance(), CWallet::GetUnconfirmedWatchOnlyBalance(), GetUTXOCoins(), GetUTXOConfirmations(), ClientModel::getVerificationProgress(), getwalletinfo(), CWallet::GetWatchOnlyBalance(), gobject(), importaddress(), importelectrumwallet(), importprivkey(), importpubkey(), importwallet(), TransactionTablePriv::index(), InitBlockIndex(), CDSNotificationInterface::InitializeCurrentBlockTip(), instantsendtoaddress(), invalidateblock(), InvalidateBlock(), CGovernanceObject::IsCollateralValid(), CPrivateSend::IsCollateralValid(), CInstantSend::IsEnoughOrphanVotesForTxAndOutPoint(), IsInitialBlockDownload(), WalletModel::isLockedCoin(), WalletModel::isSpent(), CTxLockRequest::IsValid(), keypoolrefill(), listaccounts(), listaddressgroupings(), WalletModel::listCoins(), WalletModel::listLockedCoins(), listlockunspent(), listreceivedbyaccount(), listreceivedbyaddress(), listsinceblock(), listtransactions(), listunspent(), LoadExternalBlockFile(), CWallet::LoadWallet(), WalletModel::lockCoin(), lockunspent(), CPrivateSendClient::MakeCollateralAmounts(), CActiveMasternode::ManageStateLocal(), CWallet::MarkConflicted(), masternode(), masternodelist(), movecmd(), CZMQPublishRawBlockNotifier::NotifyBlock(), NotifyHeaderTip(), WalletModel::pollBalanceChanged(), PrepareShutdown(), WalletModel::prepareTransaction(), prioritisetransaction(), ProcessBlockFound(), ProcessGetData(), CPrivateSendServer::ProcessMessage(), CInstantSend::ProcessMessage(), CMasternodeMan::ProcessMessage(), CGovernanceManager::ProcessMessage(), ProcessMessage(), ProcessNewBlock(), ProcessNewBlockHeaders(), CInstantSend::ProcessOrphanTxLockVotes(), CSporkManager::ProcessSpork(), CInstantSend::ProcessTxLockRequest(), CInstantSend::ProcessTxLockVote(), CWallet::ReacceptWalletTransactions(), reconsiderblock(), ReconsiderBlock(), PeerTablePriv::refreshPeers(), TransactionTablePriv::refreshWallet(), ReprocessBlocks(), CGovernanceManager::RequestGovernanceObjectVotes(), CMasternodePayments::RequestLowDataPaymentBlocks(), resendwallettransactions(), CInstantSend::ResolveConflicts(), rest_block(), rest_getutxos(), rest_headers(), CWallet::ScanForWalletTransactions(), CWallet::SelectCoinsGrouppedByAddresses(), WalletModel::sendCoins(), CPrivateSendClient::SendDenominate(), sendfrom(), sendmany(), SendMessages(), sendrawtransaction(), sendtoaddress(), setaccount(), CMerkleTx::SetMerkleBranch(), setmocktime(), settxfee(), signmessage(), signrawtransaction(), CMasternodePing::SimpleCheck(), TransactionRecord::statusUpdateNeeded(), submitblock(), CGovernanceManager::Sync(), CInstantSend::SyncTransaction(), CPrivateSend::SyncTransaction(), CWallet::SyncTransaction(), TestBlockValidity(), TestLockPointValidity(), TransactionDesc::toHTML(), WalletModel::transactionCanBeAbandoned(), CInstantSend::TryToFinalizeLockCandidate(), UnloadBlockIndex(), WalletModel::unlockCoin(), CGovernanceManager::UpdateCachesAndClean(), CGovernanceObject::UpdateLocalValidity(), CMasternodeMan::UpdateMasternodeList(), TransactionRecord::updateStatus(), TransactionTablePriv::updateWallet(), validateaddress(), verifychain(), CVerifyDB::VerifyDB(), verifymessage(), verifytxoutproof(), VersionBitsTipState(), CInstantSend::Vote(), walletlock(), walletpassphrase(), and walletpassphrasechange().

◆ csBestBlock

Definition at line 67 of file validation.cpp.

Referenced by getblocktemplate().

◆ cvBlockChange

CConditionVariable cvBlockChange

Definition at line 68 of file validation.cpp.

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

◆ DATABASE_FLUSH_INTERVAL

const unsigned int DATABASE_FLUSH_INTERVAL = 24 * 60 * 60
static

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

Definition at line 101 of file validation.h.

Referenced by FlushStateToDisk().

◆ DATABASE_WRITE_INTERVAL

const unsigned int DATABASE_WRITE_INTERVAL = 60 * 60
static

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

Definition at line 99 of file validation.h.

Referenced by FlushStateToDisk().

◆ DEFAULT_ADDRESSINDEX

const bool DEFAULT_ADDRESSINDEX = false
static

Definition at line 124 of file validation.h.

Referenced by HelpMessage(), and InitBlockIndex().

◆ DEFAULT_ALERTS

const bool DEFAULT_ALERTS = true
static

Default for accepting alerts from the P2P network.

Definition at line 51 of file validation.h.

Referenced by AppInit2(), and HelpMessage().

◆ DEFAULT_ANCESTOR_LIMIT

const unsigned int DEFAULT_ANCESTOR_LIMIT = 25
static

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

Definition at line 66 of file validation.h.

Referenced by AcceptToMemoryPoolWorker(), and HelpMessage().

◆ DEFAULT_ANCESTOR_SIZE_LIMIT

const unsigned int DEFAULT_ANCESTOR_SIZE_LIMIT = 101
static

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

Definition at line 68 of file validation.h.

Referenced by AcceptToMemoryPoolWorker(), and HelpMessage().

◆ DEFAULT_BANSCORE_THRESHOLD

const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100
static

Definition at line 127 of file validation.h.

Referenced by HelpMessage(), and Misbehaving().

◆ DEFAULT_BYTES_PER_SIGOP

const unsigned int DEFAULT_BYTES_PER_SIGOP = 20
static

Definition at line 121 of file validation.h.

Referenced by HelpMessage().

◆ DEFAULT_CHECKBLOCKS

const signed int DEFAULT_CHECKBLOCKS = MIN_BLOCKS_TO_KEEP
static

Definition at line 190 of file validation.h.

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

◆ DEFAULT_CHECKLEVEL

const unsigned int DEFAULT_CHECKLEVEL = 3
static

Definition at line 191 of file validation.h.

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

◆ DEFAULT_CHECKPOINTS_ENABLED

const bool DEFAULT_CHECKPOINTS_ENABLED = true
static

Definition at line 122 of file validation.h.

Referenced by AppInit2(), and HelpMessage().

◆ DEFAULT_DESCENDANT_LIMIT

const unsigned int DEFAULT_DESCENDANT_LIMIT = 25
static

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

Definition at line 70 of file validation.h.

Referenced by AcceptToMemoryPoolWorker(), and HelpMessage().

◆ DEFAULT_DESCENDANT_SIZE_LIMIT

const unsigned int DEFAULT_DESCENDANT_SIZE_LIMIT = 101
static

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

Definition at line 72 of file validation.h.

Referenced by AcceptToMemoryPoolWorker(), AppInit2(), and HelpMessage().

◆ DEFAULT_DIP0001_MIN_RELAY_TX_FEE

const unsigned int DEFAULT_DIP0001_MIN_RELAY_TX_FEE = 1000
static

Definition at line 62 of file validation.h.

Referenced by CDSNotificationInterface::UpdatedBlockTip().

◆ DEFAULT_ENABLE_REPLACEMENT

const bool DEFAULT_ENABLE_REPLACEMENT = false
static

Default for -mempoolreplacement

Definition at line 131 of file validation.h.

Referenced by AppInit2(), and HelpMessage().

◆ DEFAULT_LEGACY_MIN_RELAY_TX_FEE

const unsigned int DEFAULT_LEGACY_MIN_RELAY_TX_FEE = 10000
static

Default for -minrelaytxfee, minimum relay fee for transactions We are ~100 times smaller then bitcoin now (2016-03-01), set minRelayTxFee only 10 times higher so it's still 10 times lower comparing to bitcoin. 2017-07: we are 10x smaller now, let's lower defaults 10x via the same BIP9 bit as DIP0001

Definition at line 61 of file validation.h.

Referenced by HelpMessage(), and CDSNotificationInterface::UpdatedBlockTip().

◆ DEFAULT_LIMITFREERELAY

const unsigned int DEFAULT_LIMITFREERELAY = 15
static

Definition at line 116 of file validation.h.

Referenced by AcceptToMemoryPoolWorker(), and HelpMessage().

◆ DEFAULT_MAX_ORPHAN_TRANSACTIONS

const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100
static

Default for -maxorphantx, maximum number of orphan transactions kept in memory

Definition at line 64 of file validation.h.

Referenced by HelpMessage(), and ProcessMessage().

◆ DEFAULT_MEMPOOL_EXPIRY

const unsigned int DEFAULT_MEMPOOL_EXPIRY = 72
static

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

Definition at line 74 of file validation.h.

Referenced by AcceptToMemoryPoolWorker(), ActivateBestChainStep(), HelpMessage(), and InvalidateBlock().

◆ DEFAULT_PERMIT_BAREMULTISIG

const bool DEFAULT_PERMIT_BAREMULTISIG = true
static

Default for -permitbaremultisig

Definition at line 120 of file validation.h.

Referenced by AppInit2(), and HelpMessage().

◆ DEFAULT_RELAYPRIORITY

const bool DEFAULT_RELAYPRIORITY = true
static

Definition at line 117 of file validation.h.

Referenced by AcceptToMemoryPoolWorker(), and HelpMessage().

◆ DEFAULT_SCRIPTCHECK_THREADS

const int DEFAULT_SCRIPTCHECK_THREADS = 0
static

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

Definition at line 85 of file validation.h.

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

◆ DEFAULT_SPENTINDEX

const bool DEFAULT_SPENTINDEX = false
static

Definition at line 126 of file validation.h.

Referenced by HelpMessage(), and InitBlockIndex().

◆ DEFAULT_TESTSAFEMODE

const bool DEFAULT_TESTSAFEMODE = false
static

Definition at line 129 of file validation.h.

Referenced by GetWarnings(), and HelpMessage().

◆ DEFAULT_TIMESTAMPINDEX

const bool DEFAULT_TIMESTAMPINDEX = false
static

Definition at line 125 of file validation.h.

Referenced by HelpMessage(), and InitBlockIndex().

◆ DEFAULT_TXINDEX

const bool DEFAULT_TXINDEX = true
static

Definition at line 123 of file validation.h.

Referenced by AppInit2(), HelpMessage(), and InitBlockIndex().

◆ DEFAULT_WHITELISTFORCERELAY

const bool DEFAULT_WHITELISTFORCERELAY = true
static

Default for DEFAULT_WHITELISTFORCERELAY.

Definition at line 55 of file validation.h.

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

◆ DEFAULT_WHITELISTRELAY

const bool DEFAULT_WHITELISTRELAY = true
static

Default for DEFAULT_WHITELISTRELAY.

Definition at line 53 of file validation.h.

Referenced by HelpMessage(), and ProcessMessage().

◆ DIP0001_PROTOCOL_VERSION

const int DIP0001_PROTOCOL_VERSION = 70208
static

Definition at line 167 of file validation.h.

Referenced by ComputeBlockVersion().

◆ fAlerts

bool fAlerts

Definition at line 85 of file validation.cpp.

Referenced by AppInit2(), and ProcessMessage().

◆ fCheckBlockIndex

bool fCheckBlockIndex

Definition at line 81 of file validation.cpp.

Referenced by AppInit2(), and CheckBlockIndex().

◆ fCheckpointsEnabled

bool fCheckpointsEnabled

Definition at line 82 of file validation.cpp.

Referenced by AcceptBlockHeader(), AppInit2(), and TestBlockValidity().

◆ fDIP0001ActiveAtTip

◆ fDIP0001WasLockedIn

◆ fEnableReplacement

bool fEnableReplacement

Definition at line 86 of file validation.cpp.

Referenced by AcceptToMemoryPoolWorker(), and AppInit2().

◆ fHavePruned

bool fHavePruned

Pruning-related variables and constants True if any block files have ever been pruned.

Definition at line 76 of file validation.cpp.

Referenced by AppInit2(), CheckBlockIndex(), FlushStateToDisk(), getblock(), LoadBlockIndexDB(), rest_block(), and UnloadBlockIndex().

◆ fImporting

◆ fIsBareMultisigStd

bool fIsBareMultisigStd

Definition at line 78 of file validation.cpp.

Referenced by AppInit2(), and IsStandardTx().

◆ fPruneMode

bool fPruneMode

◆ fReindex

◆ fRequireStandard

bool fRequireStandard

Definition at line 79 of file validation.cpp.

Referenced by AcceptToMemoryPoolWorker(), and AppInit2().

◆ fTxIndex

bool fTxIndex

◆ hashAssumeValid

uint256 hashAssumeValid

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

Definition at line 91 of file validation.cpp.

Referenced by AppInit2(), and ConnectBlock().

◆ mapBlockIndex

◆ mapRejectedBlocks

std::map<uint256, int64_t> mapRejectedBlocks

◆ MAX_BLOCKFILE_SIZE

const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000
static

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

Definition at line 76 of file validation.h.

Referenced by FindBlockPos().

◆ MAX_BLOCKS_IN_TRANSIT_PER_PEER

const int MAX_BLOCKS_IN_TRANSIT_PER_PEER = 16
static

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

Definition at line 87 of file validation.h.

Referenced by ProcessMessage(), and SendMessages().

◆ MAX_BLOCKS_TO_ANNOUNCE

const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8
static

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

Definition at line 134 of file validation.h.

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

◆ MAX_HEADERS_RESULTS

const unsigned int MAX_HEADERS_RESULTS = 2000
static

Number of headers sent in one getheaders result. We rely on the assumption that if a peer sends less than this number, we reached its tip. Changing this value is a protocol upgrade.

Definition at line 92 of file validation.h.

Referenced by getblockheaders(), and ProcessMessage().

◆ MAX_REJECT_MESSAGE_LENGTH

const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111
static

Maximum length of reject messages.

Definition at line 103 of file validation.h.

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

◆ MAX_SCRIPTCHECK_THREADS

const int MAX_SCRIPTCHECK_THREADS = 16
static

Maximum number of script-checking threads allowed

Definition at line 83 of file validation.h.

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

◆ mempool

◆ MIN_BLOCKS_TO_KEEP

const unsigned int MIN_BLOCKS_TO_KEEP = 288
static

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

Definition at line 188 of file validation.h.

Referenced by AcceptBlock(), AppInit2(), FindFilesToPrune(), and ProcessMessage().

◆ MIN_DISK_SPACE_FOR_BLOCK_FILES

const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 945 * 1024 * 1024
static

Definition at line 201 of file validation.h.

Referenced by AppInit2(), and HelpMessage().

◆ minRelayTxFee

◆ nBytesPerSigOp

unsigned int nBytesPerSigOp

Definition at line 80 of file validation.cpp.

Referenced by AcceptToMemoryPoolWorker(), and AppInit2().

◆ nCoinCacheUsage

size_t nCoinCacheUsage

Definition at line 83 of file validation.cpp.

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

◆ nLastBlockSize

uint64_t nLastBlockSize

Definition at line 49 of file miner.cpp.

Referenced by CreateNewBlock(), and getmininginfo().

◆ nLastBlockTx

uint64_t nLastBlockTx

Definition at line 48 of file miner.cpp.

Referenced by CreateNewBlock(), and getmininginfo().

◆ nMinDiskSpace

const uint64_t nMinDiskSpace = 52428800
static

Minimum disk space required - used in CheckDiskSpace()

Definition at line 178 of file validation.h.

Referenced by CheckDiskSpace().

◆ nPruneTarget

uint64_t nPruneTarget

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

Definition at line 84 of file validation.cpp.

Referenced by AppInit2(), and FindFilesToPrune().

◆ nScriptCheckThreads

int nScriptCheckThreads

Definition at line 69 of file validation.cpp.

Referenced by AppInit2(), and ConnectBlock().

◆ pblocktree

CBlockTreeDB* pblocktree

◆ pcoinsTip

◆ pindexBestHeader

◆ REJECT_ALREADY_KNOWN

const unsigned int REJECT_ALREADY_KNOWN = 0x101
static

Transaction is already known (either in mempool or blockchain)

Definition at line 864 of file validation.h.

Referenced by AcceptToMemoryPoolWorker().

◆ REJECT_CONFLICT

const unsigned int REJECT_CONFLICT = 0x102
static

Transaction conflicts with a transaction already known

Definition at line 866 of file validation.h.

Referenced by AcceptToMemoryPoolWorker().

◆ REJECT_HIGHFEE

const unsigned int REJECT_HIGHFEE = 0x100
static

Too high fee. Can not be triggered by P2P transactions

Definition at line 862 of file validation.h.

Referenced by AcceptToMemoryPoolWorker().

◆ REJECT_INTERNAL

const unsigned int REJECT_INTERNAL = 0x100
static

Reject codes greater or equal to this can be returned by AcceptToMemPool for transactions, to signal internal conditions. They cannot and should not be sent over the P2P network.

Definition at line 860 of file validation.h.

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

◆ strMessageMagic

◆ UNDOFILE_CHUNK_SIZE

const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000
static

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

Definition at line 80 of file validation.h.

Referenced by FindFilesToPrune(), and FindUndoPos().

◆ versionbitscache