![]() |
PIVX Core
5.6.99
P2P Digital Currency
|
#include "validation.h"#include "addrman.h"#include "blocksignature.h"#include "budget/budgetmanager.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 "consensus/zerocoin_verify.h"#include "evo/evodb.h"#include "evo/specialtx_validation.h"#include "flatfile.h"#include "guiinterface.h"#include "interfaces/handler.h"#include "invalid.h"#include "kernel.h"#include "legacy/validation_zerocoin_legacy.h"#include "llmq/quorums_chainlocks.h"#include "masternode-payments.h"#include "masternodeman.h"#include "policy/policy.h"#include "pow.h"#include "reverse_iterate.h"#include "script/sigcache.h"#include "shutdown.h"#include "spork.h"#include "sporkdb.h"#include "tiertwo/tiertwo_sync_state.h"#include "txdb.h"#include "undo.h"#include "util/blockstatecatcher.h"#include "util/system.h"#include "util/validation.h"#include "utilmoneystr.h"#include "validationinterface.h"#include "warnings.h"#include "zpiv/zpivmodule.h"#include <future>#include <boost/algorithm/string/replace.hpp>#include <boost/thread.hpp>#include <atomic>#include <queue>Go to the source code of this file.
Classes | |
| 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 |
Namespaces | |
| Consensus | |
Enumerations | |
| enum | FlushStateMode { FLUSH_STATE_NONE , FLUSH_STATE_IF_NEEDED , FLUSH_STATE_PERIODIC , FLUSH_STATE_ALWAYS } |
| enum | DisconnectResult { DISCONNECT_OK , DISCONNECT_UNCLEAN , DISCONNECT_FAILED } |
Functions | |
| CBlockIndex * | FindForkInGlobalIndex (const CChain &chain, const CBlockLocator &locator) |
| Find the last common block between the parameter chain and a locator. More... | |
| CBlockIndex * | GetChainTip () |
| Return a reliable pointer (in mapBlockIndex) to the chain's tip index. More... | |
| bool | CheckFinalTx (const CTransactionRef &tx, int flags) |
| Check if transaction will be final in the next block to be created. More... | |
| void | LimitMempoolSize (CTxMemPool &pool, size_t limit, unsigned long age) |
| CAmount | GetMinRelayFee (const CTransaction &tx, const CTxMemPool &pool, unsigned int nBytes) |
| CAmount | GetMinRelayFee (unsigned int nBytes) |
| CAmount | GetShieldedTxMinFee (const CTransaction &tx) |
| Return the minimum fee for a shielded tx. More... | |
| bool | AcceptToMemoryPoolWithTime (CTxMemPool &pool, CValidationState &state, const CTransactionRef &tx, bool fLimitFree, bool *pfMissingInputs, int64_t nAcceptTime, bool fOverrideMempoolLimit, bool fRejectAbsurdFee, bool fIgnoreFees) |
| (try to) add transaction to memory pool with a specified acceptance time More... | |
| bool | AcceptToMemoryPool (CTxMemPool &pool, CValidationState &state, const CTransactionRef &tx, bool fLimitFree, bool *pfMissingInputs, bool fOverrideMempoolLimit, bool fRejectInsaneFee, bool ignoreFees) |
| (try to) add transaction to memory pool More... | |
| bool | GetOutput (const uint256 &hash, unsigned int index, CValidationState &state, CTxOut &out) |
| Retrieve an output (from memory pool, or from disk, if possible) More... | |
| bool | GetTransaction (const uint256 &hash, CTransactionRef &txOut, uint256 &hashBlock, bool fAllowSlow, CBlockIndex *blockIndex) |
| Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock. More... | |
| bool | WriteBlockToDisk (const CBlock &block, FlatFilePos &pos) |
| Functions for disk access for blocks. More... | |
| bool | ReadBlockFromDisk (CBlock &block, const FlatFilePos &pos) |
| bool | ReadBlockFromDisk (CBlock &block, const CBlockIndex *pindex) |
| double | ConvertBitsToDouble (unsigned int nBits) |
| CAmount | GetBlockValue (int nHeight) |
| int64_t | GetMasternodePayment (int nHeight) |
| bool | IsInitialBlockDownload () |
| Check whether we are doing an initial block download (synchronizing from disk or network) More... | |
| void | CheckForkWarningConditions () |
| void | CheckForkWarningConditionsOnNewFork (CBlockIndex *pindexNewForkTip) |
| void | UpdateCoins (const CTransaction &tx, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight, bool fSkipInvalid) |
| void | UpdateCoins (const CTransaction &tx, CCoinsViewCache &inputs, int nHeight, bool fSkipInvalid) |
| 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... | |
| bool | Consensus::CheckTxInputs (const CTransaction &tx, CValidationState &state, const CCoinsViewCache &inputs, int nSpendHeight) |
| bool | CheckInputs (const CTransaction &tx, CValidationState &state, const CCoinsViewCache &inputs, bool fScriptChecks, unsigned int flags, bool cacheStore, PrecomputedTransactionData &precomTxData, std::vector< CScriptCheck > *pvChecks) |
| Check transaction inputs, and make sure any pay-to-script-hash transactions are evaluating IsStandard scripts. More... | |
| int | ApplyTxInUndo (Coin &&undo, CCoinsViewCache &view, const COutPoint &out) |
| Restore the UTXO in a Coin at a given COutPoint. More... | |
| DisconnectResult | DisconnectBlock (CBlock &block, const CBlockIndex *pindex, CCoinsViewCache &view) |
| Undo the effects of this block (with given index) on the UTXO set represented by coins. More... | |
| bool | FindUndoPos (CValidationState &state, int nFile, FlatFilePos &pos, unsigned int nAddSize) |
| void | ThreadScriptCheck () |
| Run an instance of the script checking thread. More... | |
| void | FlushStateToDisk () |
| Flush all state, indexes and buffers to disk. More... | |
| bool | ActivateBestChain (CValidationState &state, std::shared_ptr< const CBlock > pblock) |
| Make the best chain active, in multiple steps. More... | |
| bool | InvalidateBlock (CValidationState &state, const CChainParams &chainparams, CBlockIndex *pindex) |
| Mark a block as invalid. More... | |
| bool | ReconsiderBlock (CValidationState &state, CBlockIndex *pindex) |
| Remove invalidity status from a block and its descendants. More... | |
| bool | ReceivedBlockTransactions (const CBlock &block, CValidationState &state, CBlockIndex *pindexNew, const FlatFilePos &pos) |
| Mark a block as having its data received and checked (up to BLOCK_VALID_TRANSACTIONS). More... | |
| bool | FindBlockPos (CValidationState &state, FlatFilePos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown=false) |
| bool | CheckColdStakeFreeOutput (const CTransaction &tx, const int nHeight) |
| bool | CheckBlock (const CBlock &block, CValidationState &state, bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) |
| Functions for validating blocks and updating the block tree. More... | |
| bool | CheckWork (const CBlock &block, const CBlockIndex *const pindexPrev) |
| bool | CheckBlockTime (const CBlockHeader &block, CValidationState &state, CBlockIndex *const pindexPrev) |
| bool | ContextualCheckBlockHeader (const CBlockHeader &block, CValidationState &state, CBlockIndex *const pindexPrev) |
| Context-dependent validity checks. More... | |
| bool | ContextualCheckBlock (const CBlock &block, CValidationState &state, CBlockIndex *const pindexPrev) |
| bool | AcceptBlockHeader (const CBlock &block, CValidationState &state, CBlockIndex **ppindex, CBlockIndex *pindexPrev) |
| bool | ProcessNewBlock (const std::shared_ptr< const CBlock > &pblock, const FlatFilePos *dbp) |
| Process an incoming block. More... | |
| bool | TestBlockValidity (CValidationState &state, const CBlock &block, CBlockIndex *const pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckBlockSig) |
| Check a block is completely valid from start to finish (only works on top of our current best block, with cs_main held) More... | |
| FILE * | OpenBlockFile (const FlatFilePos &pos, bool fReadOnly) |
| Open a block file (blk?????.dat) More... | |
| FILE * | OpenUndoFile (const FlatFilePos &pos, bool fReadOnly) |
| Open an undo file (rev?????.dat) More... | |
| fs::path | GetBlockPosFilename (const FlatFilePos &pos) |
| Translation to a filesystem path. More... | |
| CBlockIndex * | InsertBlockIndex (const uint256 &hash) |
| Create a new block index entry for a given block hash. More... | |
| 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 (std::string &strError) |
| Load the block tree and coins database from disk, initializing state if we're running with -reindex. More... | |
| bool | LoadGenesisBlock () |
| Ensures we have a genesis block in the block tree, possibly writing one to disk. More... | |
| bool | LoadExternalBlockFile (FILE *fileIn, FlatFilePos *dbp) |
| Import blocks from an external file. More... | |
| int | ActiveProtocol () |
| See whether the protocol update is enforced for connected nodes. More... | |
| CBlockFileInfo * | GetBlockFileInfo (size_t n) |
| Get block file info entry for one block file. More... | |
| bool | LoadMempool (CTxMemPool &pool) |
| Load the mempool from disk. More... | |
| bool | DumpMempool (const CTxMemPool &pool) |
| Dump the mempool to disk. More... | |
Variables | |
| RecursiveMutex | cs_main |
| Global state. More... | |
| BlockMap | mapBlockIndex |
| PrevBlockMap | mapPrevBlockIndex |
| CChain | 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... | |
| Mutex | g_best_block_mutex |
| std::condition_variable | g_best_block_cv |
| uint256 | g_best_block |
| int64_t | g_best_block_time = 0 |
| int | nScriptCheckThreads = 0 |
| std::atomic< bool > | fImporting {false} |
| std::atomic< bool > | fReindex {false} |
| bool | fTxIndex = true |
| bool | fRequireStandard = true |
| bool | fCheckBlockIndex = false |
| size_t | nCoinCacheUsage = 5000 * 300 |
| int64_t | nMaxTipAge = DEFAULT_MAX_TIP_AGE |
| CFeeRate | minRelayTxFee = CFeeRate(10000) |
| Fees smaller than this (in upiv) are considered zero fee (for relaying, mining and transaction creation) We are ~100 times smaller then bitcoin now (2015-06-23), set minRelayTxFee only 10 times higher so it's still 10 times lower comparing to bitcoin. More... | |
| CTxMemPool | mempool (::minRelayTxFee) |
| std::map< uint256, int64_t > | mapRejectedBlocks |
| CMoneySupply | MoneySupply |
| CScript | COINBASE_FLAGS |
| Constant stuff for coinbase transactions we create: More... | |
| 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... | |
| std::unique_ptr< CZerocoinDB > | zerocoinDB |
| Global variable that points to the zerocoin database (protected by cs_main) More... | |
| std::unique_ptr< CSporkDB > | pSporkDB |
| Global variable that points to the spork database (protected by cs_main) More... | |
| std::unique_ptr< AccumulatorCache > | accumulatorCache |
| In-memory cache for the zerocoin accumulators. More... | |
| CBlockIndex * | pindexBestForkTip = nullptr |
| CBlockIndex * | pindexBestForkBase = nullptr |
| class CMainCleanup | instance_of_cmaincleanup |
| enum DisconnectResult |
| Enumerator | |
|---|---|
| DISCONNECT_OK | |
| DISCONNECT_UNCLEAN | |
| DISCONNECT_FAILED | |
Definition at line 1241 of file validation.cpp.
| enum FlushStateMode |
| Enumerator | |
|---|---|
| FLUSH_STATE_NONE | |
| FLUSH_STATE_IF_NEEDED | |
| FLUSH_STATE_PERIODIC | |
| FLUSH_STATE_ALWAYS | |
Definition at line 212 of file validation.cpp.
| bool AcceptBlockHeader | ( | const CBlock & | block, |
| CValidationState & | state, | ||
| CBlockIndex ** | ppindex, | ||
| CBlockIndex * | pindexPrev | ||
| ) |
Definition at line 3034 of file validation.cpp.
| bool AcceptToMemoryPool | ( | CTxMemPool & | pool, |
| CValidationState & | state, | ||
| const CTransactionRef & | tx, | ||
| bool | fLimitFree, | ||
| bool * | pfMissingInputs, | ||
| bool | fOverrideMempoolLimit, | ||
| bool | fRejectInsaneFee, | ||
| bool | ignoreFees | ||
| ) |
(try to) add transaction to memory pool
Definition at line 649 of file validation.cpp.
| bool AcceptToMemoryPoolWithTime | ( | CTxMemPool & | pool, |
| CValidationState & | state, | ||
| const CTransactionRef & | tx, | ||
| bool | fLimitFree, | ||
| bool * | pfMissingInputs, | ||
| int64_t | nAcceptTime, | ||
| bool | fOverrideMempoolLimit, | ||
| bool | fRejectAbsurdFee, | ||
| bool | fIgnoreFees | ||
| ) |
(try to) add transaction to memory pool with a specified acceptance time
Definition at line 632 of file validation.cpp.
| bool ActivateBestChain | ( | CValidationState & | state, |
| std::shared_ptr< const CBlock > | pblock | ||
| ) |
Make the best chain active, in multiple steps.
Find the best known block, and make it the tip of the block chain.
The result is either failure or an activated best chain. pblock is either nullptr or a pointer to a block that is already loaded (to avoid loading it again from disk).
Definition at line 2280 of file validation.cpp.
| int ActiveProtocol | ( | ) |
See whether the protocol update is enforced for connected nodes.
Definition at line 4222 of file validation.cpp.
| int ApplyTxInUndo | ( | Coin && | undo, |
| CCoinsViewCache & | view, | ||
| const COutPoint & | out | ||
| ) |
Restore the UTXO in a Coin at a given COutPoint.
| 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. |
Definition at line 1255 of file validation.cpp.
| bool CheckBlock | ( | const CBlock & | block, |
| CValidationState & | state, | ||
| bool | fCheckPOW = true, |
||
| bool | fCheckMerkleRoot = true, |
||
| bool | fCheckSig = true |
||
| ) |
Functions for validating blocks and updating the block tree.
Context-independent validity checks
Definition at line 2701 of file validation.cpp.
| bool CheckBlockTime | ( | const CBlockHeader & | block, |
| CValidationState & | state, | ||
| CBlockIndex *const | pindexPrev | ||
| ) |
| bool CheckColdStakeFreeOutput | ( | const CTransaction & | tx, |
| const int | nHeight | ||
| ) |
| bool CheckFinalTx | ( | const CTransactionRef & | tx, |
| int | flags = -1 |
||
| ) |
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 224 of file validation.cpp.
| void CheckForkWarningConditions | ( | ) |
Definition at line 905 of file validation.cpp.
| void CheckForkWarningConditionsOnNewFork | ( | CBlockIndex * | pindexNewForkTip | ) |
| bool CheckInputs | ( | const CTransaction & | tx, |
| CValidationState & | state, | ||
| const CCoinsViewCache & | view, | ||
| bool | fScriptChecks, | ||
| unsigned int | flags, | ||
| bool | cacheStore, | ||
| PrecomputedTransactionData & | precomTxData, | ||
| std::vector< CScriptCheck > * | pvChecks = nullptr |
||
| ) |
Check transaction inputs, and make sure any pay-to-script-hash transactions are evaluating IsStandard scripts.
Why bother? To avoid denial-of-service attacks; an attacker can submit a standard HASH... OP_EQUAL transaction, which will get accepted into blocks. The redemption script can be anything; an attacker could use a very expensive-to-check-upon-redemption script like: DUP CHECKSIG DROP ... repeated 100 times... OP_1 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.
Definition at line 1104 of file validation.cpp.
| bool CheckWork | ( | const CBlock & | block, |
| const CBlockIndex *const | pindexPrev | ||
| ) |
| bool ContextualCheckBlock | ( | const CBlock & | block, |
| CValidationState & | state, | ||
| CBlockIndex *const | pindexPrev | ||
| ) |
| bool ContextualCheckBlockHeader | ( | const CBlockHeader & | block, |
| CValidationState & | state, | ||
| CBlockIndex *const | pindexPrev | ||
| ) |
Context-dependent validity checks.
Definition at line 2909 of file validation.cpp.
| double ConvertBitsToDouble | ( | unsigned int | nBits | ) |
| DisconnectResult DisconnectBlock | ( | CBlock & | block, |
| const CBlockIndex * | pindex, | ||
| CCoinsViewCache & | view | ||
| ) |
Undo the effects of this block (with given index) on the UTXO set represented by coins.
When FAILED is returned, view is left in an indeterminate state.
Definition at line 1286 of file validation.cpp.
| bool DumpMempool | ( | const CTxMemPool & | pool | ) |
Dump the mempool to disk.
Definition at line 4312 of file validation.cpp.
| bool FindBlockPos | ( | CValidationState & | state, |
| FlatFilePos & | pos, | ||
| unsigned int | nAddSize, | ||
| unsigned int | nHeight, | ||
| uint64_t | nTime, | ||
| bool | fKnown = false |
||
| ) |
Definition at line 2570 of file validation.cpp.
| CBlockIndex* FindForkInGlobalIndex | ( | const CChain & | chain, |
| const CBlockLocator & | locator | ||
| ) |
Find the last common block between the parameter chain and a locator.
Definition at line 181 of file validation.cpp.
| bool FindUndoPos | ( | CValidationState & | state, |
| int | nFile, | ||
| FlatFilePos & | pos, | ||
| unsigned int | nAddSize | ||
| ) |
Definition at line 2617 of file validation.cpp.
| void FlushStateToDisk | ( | ) |
Flush all state, indexes and buffers to disk.
Definition at line 1848 of file validation.cpp.
| CBlockFileInfo* GetBlockFileInfo | ( | size_t | n | ) |
Get block file info entry for one block file.
Definition at line 4240 of file validation.cpp.
| fs::path GetBlockPosFilename | ( | const FlatFilePos & | pos | ) |
Translation to a filesystem path.
Definition at line 3504 of file validation.cpp.
| CAmount GetBlockValue | ( | int | nHeight | ) |
Definition at line 816 of file validation.cpp.
| CBlockIndex* GetChainTip | ( | ) |
Return a reliable pointer (in mapBlockIndex) to the chain's tip index.
Definition at line 194 of file validation.cpp.
| int64_t GetMasternodePayment | ( | int | nHeight | ) |
Definition at line 852 of file validation.cpp.
| CAmount GetMinRelayFee | ( | const CTransaction & | tx, |
| const CTxMemPool & | pool, | ||
| unsigned int | nBytes | ||
| ) |
Definition at line 265 of file validation.cpp.
| CAmount GetMinRelayFee | ( | unsigned int | nBytes | ) |
| bool GetOutput | ( | const uint256 & | hash, |
| unsigned int | index, | ||
| CValidationState & | state, | ||
| CTxOut & | out | ||
| ) |
Retrieve an output (from memory pool, or from disk, if possible)
Definition at line 656 of file validation.cpp.
| CAmount GetShieldedTxMinFee | ( | const CTransaction & | tx | ) |
Return the minimum fee for a shielded tx.
Definition at line 288 of file validation.cpp.
| 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 1044 of file validation.cpp.
| bool GetTransaction | ( | const uint256 & | hash, |
| CTransactionRef & | txOut, | ||
| uint256 & | hashBlock, | ||
| bool | fAllowSlow, | ||
| CBlockIndex * | blockIndex | ||
| ) |
Return transaction in tx, 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)
Definition at line 671 of file validation.cpp.
| CBlockIndex* InsertBlockIndex | ( | const uint256 & | hash | ) |
Create a new block index entry for a given block hash.
Definition at line 3509 of file validation.cpp.
| bool InvalidateBlock | ( | CValidationState & | state, |
| const CChainParams & | chainparams, | ||
| CBlockIndex * | pindex | ||
| ) |
Mark a block as invalid.
Definition at line 2376 of file validation.cpp.
| bool IsInitialBlockDownload | ( | ) |
Check whether we are doing an initial block download (synchronizing from disk or network)
Definition at line 862 of file validation.cpp.
| void LimitMempoolSize | ( | CTxMemPool & | pool, |
| size_t | limit, | ||
| unsigned long | age | ||
| ) |
| bool LoadBlockIndex | ( | std::string & | strError | ) |
Load the block tree and coins database from disk, initializing state if we're running with -reindex.
Definition at line 3903 of file validation.cpp.
| bool LoadChainTip | ( | const CChainParams & | chainparams | ) |
Update the chain tip based on database information.
Definition at line 3642 of file validation.cpp.
| bool LoadExternalBlockFile | ( | FILE * | fileIn, |
| FlatFilePos * | dbp | ||
| ) |
Import blocks from an external file.
Definition at line 3962 of file validation.cpp.
| bool LoadGenesisBlock | ( | ) |
Ensures we have a genesis block in the block tree, possibly writing one to disk.
Definition at line 3930 of file validation.cpp.
| bool LoadMempool | ( | CTxMemPool & | pool | ) |
Load the mempool from disk.
Definition at line 4247 of file validation.cpp.
| FILE* OpenBlockFile | ( | const FlatFilePos & | pos, |
| bool | fReadOnly | ||
| ) |
Open a block file (blk?????.dat)
Definition at line 3494 of file validation.cpp.
| FILE* OpenUndoFile | ( | const FlatFilePos & | pos, |
| bool | fReadOnly | ||
| ) |
Open an undo file (rev?????.dat)
Definition at line 3499 of file validation.cpp.
| bool ProcessNewBlock | ( | const std::shared_ptr< const CBlock > & | pblock, |
| const FlatFilePos * | dbp | ||
| ) |
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.
| [in] | pblock | The block we want to process. |
| [out] | dbp | The already known disk position of pblock, or nullptr if not yet stored. |
Definition at line 3412 of file validation.cpp.
| bool ReadBlockFromDisk | ( | CBlock & | block, |
| const CBlockIndex * | pindex | ||
| ) |
| bool ReadBlockFromDisk | ( | CBlock & | block, |
| const FlatFilePos & | pos | ||
| ) |
Definition at line 758 of file validation.cpp.
| bool ReceivedBlockTransactions | ( | const CBlock & | block, |
| CValidationState & | state, | ||
| CBlockIndex * | pindexNew, | ||
| const FlatFilePos & | pos | ||
| ) |
Mark a block as having its data received and checked (up to BLOCK_VALID_TRANSACTIONS).
Definition at line 2504 of file validation.cpp.
| bool ReconsiderBlock | ( | CValidationState & | state, |
| CBlockIndex * | pindex | ||
| ) |
Remove invalidity status from a block and its descendants.
Definition at line 2419 of file validation.cpp.
| bool ReplayBlocks | ( | const CChainParams & | params, |
| CCoinsView * | view | ||
| ) |
Replay blocks that aren't fully applied to the database.
Definition at line 3813 of file validation.cpp.
| bool TestBlockValidity | ( | CValidationState & | state, |
| const CBlock & | block, | ||
| CBlockIndex *const | pindexPrev, | ||
| bool | fCheckPOW, | ||
| bool | fCheckMerkleRoot, | ||
| bool | fCheckBlockSig | ||
| ) |
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 3450 of file validation.cpp.
| void ThreadScriptCheck | ( | ) |
Run an instance of the script checking thread.
Definition at line 1413 of file validation.cpp.
| void UnloadBlockIndex | ( | ) |
Unload database information.
Definition at line 3882 of file validation.cpp.
| void UpdateCoins | ( | const CTransaction & | tx, |
| CCoinsViewCache & | inputs, | ||
| CTxUndo & | txundo, | ||
| int | nHeight, | ||
| bool | fSkipInvalid | ||
| ) |
Definition at line 1014 of file validation.cpp.
| void UpdateCoins | ( | const CTransaction & | tx, |
| CCoinsViewCache & | inputs, | ||
| int | nHeight, | ||
| bool | fSkipInvalid | ||
| ) |
Apply the effects of this transaction on the UTXO set represented by view.
Definition at line 1032 of file validation.cpp.
| bool WriteBlockToDisk | ( | const CBlock & | block, |
| FlatFilePos & | pos | ||
| ) |
Functions for disk access for blocks.
Definition at line 737 of file validation.cpp.
| std::unique_ptr<AccumulatorCache> accumulatorCache |
In-memory cache for the zerocoin accumulators.
Definition at line 210 of file validation.cpp.
| CChain chainActive |
The currently-connected chain of blocks (protected by cs_main).
Definition at line 84 of file validation.cpp.
| CScript COINBASE_FLAGS |
Constant stuff for coinbase transactions we create:
Definition at line 119 of file validation.cpp.
| RecursiveMutex cs_main |
Global state.
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
This may also need to be locked when updating the transaction pool, e.g. on AcceptToMemoryPool. See CTxMemPool::cs comment for details.
The transaction pool has a separate lock to allow reading from it and the chainstate at the same time.
Definition at line 80 of file validation.cpp.
| bool fCheckBlockIndex = false |
Definition at line 98 of file validation.cpp.
| std::atomic<bool> fImporting {false} |
Definition at line 94 of file validation.cpp.
| std::atomic<bool> fReindex {false} |
Definition at line 95 of file validation.cpp.
| bool fRequireStandard = true |
Definition at line 97 of file validation.cpp.
| bool fTxIndex = true |
Definition at line 96 of file validation.cpp.
| uint256 g_best_block |
Definition at line 90 of file validation.cpp.
| std::condition_variable g_best_block_cv |
Definition at line 89 of file validation.cpp.
| Mutex g_best_block_mutex |
Definition at line 88 of file validation.cpp.
| int64_t g_best_block_time = 0 |
Definition at line 91 of file validation.cpp.
| class CMainCleanup instance_of_cmaincleanup |
| BlockMap mapBlockIndex |
Definition at line 82 of file validation.cpp.
| PrevBlockMap mapPrevBlockIndex |
Definition at line 83 of file validation.cpp.
| std::map<uint256, int64_t> mapRejectedBlocks |
Definition at line 112 of file validation.cpp.
| CTxMemPool mempool(::minRelayTxFee) | ( | ::minRelayTxFee | ) |
Fees smaller than this (in upiv) are considered zero fee (for relaying, mining and transaction creation) We are ~100 times smaller then bitcoin now (2015-06-23), set minRelayTxFee only 10 times higher so it's still 10 times lower comparing to bitcoin.
Definition at line 108 of file validation.cpp.
| CMoneySupply MoneySupply |
Definition at line 114 of file validation.cpp.
| size_t nCoinCacheUsage = 5000 * 300 |
Definition at line 99 of file validation.cpp.
| int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE |
Definition at line 102 of file validation.cpp.
| int nScriptCheckThreads = 0 |
Definition at line 93 of file validation.cpp.
| std::unique_ptr<CBlockTreeDB> pblocktree |
Global variable that points to the active block tree (protected by cs_main)
Definition at line 207 of file validation.cpp.
| std::unique_ptr<CCoinsViewDB> pcoinsdbview |
Global variable that points to the coins database (protected by cs_main)
Definition at line 205 of file validation.cpp.
| std::unique_ptr<CCoinsViewCache> pcoinsTip |
Global variable that points to the active CCoinsView (protected by cs_main)
Definition at line 206 of file validation.cpp.
| CBlockIndex * pindexBestForkBase = nullptr |
Definition at line 885 of file validation.cpp.
| CBlockIndex* pindexBestForkTip = nullptr |
Definition at line 885 of file validation.cpp.
| CBlockIndex* pindexBestHeader = nullptr |
Best header we've seen so far (used for getheaders queries' starting points).
Definition at line 85 of file validation.cpp.
| std::unique_ptr<CSporkDB> pSporkDB |
Global variable that points to the spork database (protected by cs_main)
Definition at line 209 of file validation.cpp.
| std::unique_ptr<CZerocoinDB> zerocoinDB |
Global variable that points to the zerocoin database (protected by cs_main)
Definition at line 208 of file validation.cpp.