![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#include "validation.h"
#include "alert.h"
#include "arith_uint256.h"
#include "chainparams.h"
#include "checkpoints.h"
#include "checkqueue.h"
#include "consensus/consensus.h"
#include "consensus/merkle.h"
#include "consensus/validation.h"
#include "hash.h"
#include "init.h"
#include "policy/policy.h"
#include "pow.h"
#include "primitives/block.h"
#include "primitives/transaction.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 "versionbits.h"
#include "instantx.h"
#include "masternodeman.h"
#include "masternode-payments.h"
#include <sstream>
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/math/distributions/poisson.hpp>
#include <boost/thread.hpp>
Go to the source code of this file.
Classes | |
class | WarningBitsConditionChecker |
class | CMainCleanup |
Namespaces | |
Consensus | |
Enumerations | |
enum | FlushStateMode { FLUSH_STATE_NONE, FLUSH_STATE_IF_NEEDED, FLUSH_STATE_PERIODIC, FLUSH_STATE_ALWAYS } |
Functions | |
map< uint256, int64_t > mapRejectedBlocks | GUARDED_BY (cs_main) |
static bool | IsSuperMajority (int minVersion, const CBlockIndex *pstart, unsigned nRequired, const Consensus::Params &consensusParams) |
static void | CheckBlockIndex (const Consensus::Params &consensusParams) |
CBlockIndex * | FindForkInGlobalIndex (const CChain &chain, const CBlockLocator &locator) |
static bool | FlushStateToDisk (CValidationState &state, FlushStateMode mode) |
bool | IsFinalTx (const CTransaction &tx, int nBlockHeight, int64_t nBlockTime) |
bool | CheckFinalTx (const CTransaction &tx, int flags) |
static std::pair< int, int64_t > | CalculateSequenceLocks (const CTransaction &tx, int flags, std::vector< int > *prevHeights, const CBlockIndex &block) |
static bool | EvaluateSequenceLocks (const CBlockIndex &block, std::pair< int, int64_t > lockPair) |
bool | SequenceLocks (const CTransaction &tx, int flags, std::vector< int > *prevHeights, const CBlockIndex &block) |
bool | TestLockPointValidity (const LockPoints *lp) |
bool | CheckSequenceLocks (const CTransaction &tx, int flags, LockPoints *lp, bool useExistingLockPoints) |
unsigned int | GetLegacySigOpCount (const CTransaction &tx) |
unsigned int | GetP2SHSigOpCount (const CTransaction &tx, const CCoinsViewCache &inputs) |
bool | GetUTXOCoins (const COutPoint &outpoint, CCoins &coins) |
int | GetUTXOHeight (const COutPoint &outpoint) |
int | GetUTXOConfirmations (const COutPoint &outpoint) |
bool | CheckTransaction (const CTransaction &tx, CValidationState &state) |
bool | ContextualCheckTransaction (const CTransaction &tx, CValidationState &state, CBlockIndex *const pindexPrev) |
void | LimitMempoolSize (CTxMemPool &pool, size_t limit, unsigned long age) |
std::string | FormatStateMessage (const CValidationState &state) |
bool | AcceptToMemoryPoolWorker (CTxMemPool &pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, bool *pfMissingInputs, bool fOverrideMempoolLimit, bool fRejectAbsurdFee, std::vector< uint256 > &vHashTxnToUncache, bool fDryRun) |
bool | AcceptToMemoryPool (CTxMemPool &pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, bool *pfMissingInputs, bool fOverrideMempoolLimit, bool fRejectAbsurdFee, bool fDryRun) |
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, CTransaction &txOut, const Consensus::Params &consensusParams, uint256 &hashBlock, bool fAllowSlow) |
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) |
double | ConvertBitsToDouble (unsigned int nBits) |
CAmount | GetBlockSubsidy (int nPrevBits, int nPrevHeight, const Consensus::Params &consensusParams, bool fSuperblockPartOnly) |
CAmount | GetMasternodePayment (int nHeight, CAmount blockValue) |
bool | IsInitialBlockDownload () |
void | CheckForkWarningConditions () |
void | CheckForkWarningConditionsOnNewFork (CBlockIndex *pindexNewForkTip) |
static void | InvalidChainFound (CBlockIndex *pindexNew) |
static void | InvalidBlockFound (CBlockIndex *pindex, const CValidationState &state) |
void | UpdateCoins (const CTransaction &tx, CValidationState &state, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight) |
void | UpdateCoins (const CTransaction &tx, CValidationState &state, CCoinsViewCache &inputs, int nHeight) |
int | GetSpendHeight (const CCoinsViewCache &inputs) |
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, std::vector< CScriptCheck > *pvChecks) |
static bool | ApplyTxInUndo (const CTxInUndo &undo, CCoinsViewCache &view, const COutPoint &out) |
bool | DisconnectBlock (const CBlock &block, CValidationState &state, const CBlockIndex *pindex, CCoinsViewCache &view, bool *pfClean) |
static void | FlushBlockFile (bool fFinalize=false) |
bool | FindUndoPos (CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize) |
void | ThreadScriptCheck () |
int32_t | ComputeBlockVersion (const CBlockIndex *pindexPrev, const Consensus::Params ¶ms, bool fAssumeMasternodeIsUpgraded) |
bool | GetBlockHash (uint256 &hashRet, int nBlockHeight) |
bool | ConnectBlock (const CBlock &block, CValidationState &state, CBlockIndex *pindex, CCoinsViewCache &view, bool fJustCheck) |
void | FlushStateToDisk () |
void | PruneAndFlush () |
static void | UpdateTip (CBlockIndex *pindexNew) |
static bool | DisconnectTip (CValidationState &state, const Consensus::Params &consensusParams) |
static bool | ConnectTip (CValidationState &state, const CChainParams &chainparams, CBlockIndex *pindexNew, const CBlock *pblock) |
bool | DisconnectBlocks (int blocks) |
void | ReprocessBlocks (int nBlocks) |
static CBlockIndex * | FindMostWorkChain () |
static void | PruneBlockIndexCandidates () |
static bool | ActivateBestChainStep (CValidationState &state, const CChainParams &chainparams, CBlockIndex *pindexMostWork, const CBlock *pblock, bool &fInvalidFound) |
static void | NotifyHeaderTip () |
bool | ActivateBestChain (CValidationState &state, const CChainParams &chainparams, const CBlock *pblock) |
bool | InvalidateBlock (CValidationState &state, const Consensus::Params &consensusParams, CBlockIndex *pindex) |
bool | ReconsiderBlock (CValidationState &state, CBlockIndex *pindex) |
CBlockIndex * | AddToBlockIndex (const CBlockHeader &block) |
bool | ReceivedBlockTransactions (const CBlock &block, CValidationState &state, CBlockIndex *pindexNew, const CDiskBlockPos &pos) |
bool | FindBlockPos (CValidationState &state, CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown=false) |
bool | CheckBlockHeader (const CBlockHeader &block, CValidationState &state, bool fCheckPOW) |
bool | CheckBlock (const CBlock &block, CValidationState &state, bool fCheckPOW, bool fCheckMerkleRoot) |
static bool | CheckIndexAgainstCheckpoint (const CBlockIndex *pindexPrev, CValidationState &state, const CChainParams &chainparams, const uint256 &hash) |
bool | ContextualCheckBlockHeader (const CBlockHeader &block, CValidationState &state, CBlockIndex *const pindexPrev) |
bool | ContextualCheckBlock (const CBlock &block, CValidationState &state, CBlockIndex *const pindexPrev) |
static bool | AcceptBlockHeader (const CBlockHeader &block, CValidationState &state, const CChainParams &chainparams, CBlockIndex **ppindex) |
bool | ProcessNewBlockHeaders (const std::vector< CBlockHeader > &headers, CValidationState &state, const CChainParams &chainparams, CBlockIndex **ppindex) |
static bool | AcceptBlock (const CBlock &block, CValidationState &state, const CChainParams &chainparams, CBlockIndex **ppindex, bool fRequested, const CDiskBlockPos *dbp, bool *fNewBlock) |
bool | ProcessNewBlock (const CChainParams &chainparams, const CBlock *pblock, bool fForceProcessing, const CDiskBlockPos *dbp, bool *fNewBlock) |
bool | TestBlockValidity (CValidationState &state, const CChainParams &chainparams, const CBlock &block, CBlockIndex *pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot) |
uint64_t | CalculateCurrentUsage () |
void | PruneOneBlockFile (const int fileNumber) |
void | UnlinkPrunedFiles (std::set< int > &setFilesToPrune) |
void | FindFilesToPrune (std::set< int > &setFilesToPrune, uint64_t nPruneAfterHeight) |
bool | CheckDiskSpace (uint64_t nAdditionalBytes) |
FILE * | OpenDiskFile (const CDiskBlockPos &pos, const char *prefix, bool fReadOnly) |
FILE * | OpenBlockFile (const CDiskBlockPos &pos, bool fReadOnly) |
FILE * | OpenUndoFile (const CDiskBlockPos &pos, bool fReadOnly) |
boost::filesystem::path | GetBlockPosFilename (const CDiskBlockPos &pos, const char *prefix) |
CBlockIndex * | InsertBlockIndex (uint256 hash) |
static bool | LoadBlockIndexDB () |
void | UnloadBlockIndex () |
bool | LoadBlockIndex () |
bool | InitBlockIndex (const CChainParams &chainparams) |
bool | LoadExternalBlockFile (const CChainParams &chainparams, FILE *fileIn, CDiskBlockPos *dbp) |
std::string | GetWarnings (const std::string &strFor) |
ThresholdState | VersionBitsTipState (const Consensus::Params ¶ms, Consensus::DeploymentPos pos) |
enum FlushStateMode |
Enumerator | |
---|---|
FLUSH_STATE_NONE | |
FLUSH_STATE_IF_NEEDED | |
FLUSH_STATE_PERIODIC | |
FLUSH_STATE_ALWAYS |
Definition at line 190 of file validation.cpp.
|
static |
Store block on disk. If dbp is non-NULL, the file is known to already reside on disk
Definition at line 3400 of file validation.cpp.
Referenced by LoadExternalBlockFile(), and ProcessNewBlock().
|
static |
Definition at line 3330 of file validation.cpp.
Referenced by AcceptBlock(), and ProcessNewBlockHeaders().
bool AcceptToMemoryPool | ( | CTxMemPool & | pool, |
CValidationState & | state, | ||
const CTransaction & | tx, | ||
bool | fLimitFree, | ||
bool * | pfMissingInputs, | ||
bool | fOverrideMempoolLimit = false , |
||
bool | fRejectAbsurdFee = false , |
||
bool | fDryRun = false |
||
) |
(try to) add transaction to memory pool
Definition at line 1014 of file validation.cpp.
Referenced by CMerkleTx::AcceptToMemoryPool(), CPrivateSendServer::ChargeFees(), CPrivateSendServer::ChargeRandomFees(), CPrivateSendServer::CommitFinalTransaction(), DisconnectTip(), CPrivateSend::IsCollateralValid(), CPrivateSendServer::ProcessMessage(), ProcessMessage(), CPrivateSendClient::SendDenominate(), and sendrawtransaction().
bool AcceptToMemoryPoolWorker | ( | CTxMemPool & | pool, |
CValidationState & | state, | ||
const CTransaction & | tx, | ||
bool | fLimitFree, | ||
bool * | pfMissingInputs, | ||
bool | fOverrideMempoolLimit, | ||
bool | fRejectAbsurdFee, | ||
std::vector< uint256 > & | vHashTxnToUncache, | ||
bool | fDryRun | ||
) |
Definition at line 549 of file validation.cpp.
Referenced by AcceptToMemoryPool().
bool ActivateBestChain | ( | CValidationState & | state, |
const CChainParams & | chainparams, | ||
const CBlock * | pblock | ||
) |
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().
|
static |
Try to make some progress towards making pindexMostWork the active block. pblock is either NULL or a pointer to a CBlock corresponding to pindexMostWork.
Definition at line 2709 of file validation.cpp.
Referenced by ActivateBestChain().
CBlockIndex* AddToBlockIndex | ( | const CBlockHeader & | block | ) |
Definition at line 2936 of file validation.cpp.
Referenced by AcceptBlockHeader(), and InitBlockIndex().
|
static |
Apply the undo operation of a CTxInUndo to the given chain state.
undo | The undo object. |
view | The coins view to which to apply the changes. |
out | The out point that corresponds to the tx input. |
Definition at line 1670 of file validation.cpp.
Referenced by DisconnectBlock().
uint64_t CalculateCurrentUsage | ( | ) |
BLOCK PRUNING CODE
Definition at line 3542 of file validation.cpp.
Referenced by FindFilesToPrune().
|
static |
Calculates the block height and previous block's median time past at which the transaction will be considered final in the context of BIP 68. Also removes from the vector of input heights any entries which did not correspond to sequence locked inputs as they do not affect the calculation.
Definition at line 251 of file validation.cpp.
Referenced by CheckSequenceLocks(), and SequenceLocks().
bool CheckBlock | ( | const CBlock & | block, |
CValidationState & | state, | ||
bool | fCheckPOW, | ||
bool | fCheckMerkleRoot | ||
) |
Definition at line 3119 of file validation.cpp.
Referenced by AcceptBlock(), ConnectBlock(), TestBlockValidity(), and CVerifyDB::VerifyDB().
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().
|
static |
Definition at line 4124 of file validation.cpp.
Referenced by AcceptBlockHeader(), ActivateBestChain(), and ProcessNewBlock().
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().
bool CheckFinalTx | ( | const CTransaction & | 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 213 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), CWallet::AvailableCoins(), TransactionDesc::FormatTxStatus(), GetAccountBalance(), CWallet::GetAddressBalances(), getbalance(), getreceivedbyaccount(), getreceivedbyaddress(), CWalletTx::IsTrusted(), CTxLockRequest::IsValid(), ListReceived(), CTxMemPool::removeForReorg(), and TransactionRecord::updateStatus().
void CheckForkWarningConditions | ( | ) |
Definition at line 1320 of file validation.cpp.
Referenced by ActivateBestChainStep(), CheckForkWarningConditionsOnNewFork(), and InvalidChainFound().
void CheckForkWarningConditionsOnNewFork | ( | CBlockIndex * | pindexNewForkTip | ) |
Definition at line 1368 of file validation.cpp.
Referenced by ActivateBestChainStep().
|
static |
Definition at line 3218 of file validation.cpp.
Referenced by AcceptBlockHeader(), and TestBlockValidity().
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().
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().
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().
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().
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().
|
static |
Connect a new block to chainActive. pblock is either NULL or a pointer to a CBlock corresponding to pindexNew, to bypass loading it again from disk.
Definition at line 2535 of file validation.cpp.
Referenced by ActivateBestChainStep().
bool ContextualCheckBlock | ( | const CBlock & | block, |
CValidationState & | state, | ||
CBlockIndex *const | pindexPrev | ||
) |
Definition at line 3275 of file validation.cpp.
Referenced by AcceptBlock(), and TestBlockValidity().
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().
bool ContextualCheckTransaction | ( | const CTransaction & | tx, |
CValidationState & | state, | ||
CBlockIndex *const | pindexPrev | ||
) |
Definition at line 518 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker().
double ConvertBitsToDouble | ( | unsigned int | nBits | ) |
Definition at line 1205 of file validation.cpp.
Referenced by ContextualCheckBlockHeader(), and GetBlockSubsidy().
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().
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().
|
static |
Disconnect chainActive's tip. You probably want to call mempool.removeForReorg and manually re-limit mempool size after this, with cs_main held.
Definition at line 2477 of file validation.cpp.
Referenced by ActivateBestChainStep(), DisconnectBlocks(), and InvalidateBlock().
|
static |
Definition at line 313 of file validation.cpp.
Referenced by CheckSequenceLocks(), and SequenceLocks().
bool FindBlockPos | ( | CValidationState & | state, |
CDiskBlockPos & | pos, | ||
unsigned int | nAddSize, | ||
unsigned int | nHeight, | ||
uint64_t | nTime, | ||
bool | fKnown = false |
||
) |
Definition at line 3016 of file validation.cpp.
Referenced by AcceptBlock(), and InitBlockIndex().
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.
[out] | setFilesToPrune | The set of file indices that can be unlinked will be returned |
Definition at line 3595 of file validation.cpp.
Referenced by FlushStateToDisk().
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().
|
static |
Return the tip of the chain with the most work in it, that isn't known to be invalid (it's however far from certain to be valid).
Definition at line 2639 of file validation.cpp.
Referenced by ActivateBestChain().
bool FindUndoPos | ( | CValidationState & | state, |
int | nFile, | ||
CDiskBlockPos & | pos, | ||
unsigned int | nAddSize | ||
) |
Definition at line 3073 of file validation.cpp.
Referenced by ConnectBlock().
|
static |
Definition at line 1843 of file validation.cpp.
Referenced by FindBlockPos(), and FlushStateToDisk().
|
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 2311 of file validation.cpp.
Referenced by AcceptBlock(), AcceptToMemoryPool(), ActivateBestChain(), ConnectTip(), DisconnectTip(), FlushStateToDisk(), gettxoutsetinfo(), InitBlockIndex(), PrepareShutdown(), and PruneAndFlush().
void FlushStateToDisk | ( | ) |
Flush all state, indexes and buffers to disk.
Definition at line 2408 of file validation.cpp.
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().
bool GetAddressIndex | ( | uint160 | addressHash, |
int | type, | ||
std::vector< std::pair< CAddressIndexKey, CAmount > > & | addressIndex, | ||
int | start, | ||
int | end | ||
) |
Definition at line 1055 of file validation.cpp.
Referenced by getaddressbalance(), getaddressdeltas(), and getaddresstxids().
bool GetAddressUnspent | ( | uint160 | addressHash, |
int | type, | ||
std::vector< std::pair< CAddressUnspentKey, CAddressUnspentValue > > & | unspentOutputs | ||
) |
Definition at line 1067 of file validation.cpp.
Referenced by getaddressutxos().
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 1911 of file validation.cpp.
Referenced by CMasternodePayments::AddPaymentVote(), CMasternodeMan::GetMasternodeByRank(), CMasternodeMan::GetMasternodeRank(), CMasternodeMan::GetMasternodeRanks(), CMasternodeMan::GetNextMasternodeInQueueForPayment(), ProcessMessage(), CMasternodeMan::ProcessVerifyBroadcast(), CMasternodeMan::ProcessVerifyReply(), CMasternodePayments::RequestLowDataPaymentBlocks(), and CMasternodeMan::SendVerifyReply().
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().
CAmount GetBlockSubsidy | ( | int | nPrevBits, |
int | nPrevHeight, | ||
const Consensus::Params & | consensusParams, | ||
bool | fSuperblockPartOnly | ||
) |
Definition at line 1230 of file validation.cpp.
Referenced by ConnectBlock(), CreateNewBlock(), and CSuperblock::GetPaymentsLimit().
unsigned int GetLegacySigOpCount | ( | const CTransaction & | tx | ) |
Count ECDSA signature operations the old-fashioned (pre-0.6) way
Definition at line 417 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), CheckBlock(), ConnectBlock(), ContextualCheckBlock(), and CreateNewBlock().
Definition at line 1276 of file validation.cpp.
Referenced by CMasternodePayments::FillBlockPayee(), CMasternodeBlockPayees::IsTransactionValid(), and CMasternode::UpdateLastPaid().
unsigned int GetP2SHSigOpCount | ( | const CTransaction & | tx, |
const CCoinsViewCache & | mapInputs | ||
) |
Count ECDSA signature operations in pay-to-script-hash inputs.
[in] | mapInputs | Map of previous transactions that have outputs we're spending |
Definition at line 431 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), and ConnectBlock().
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().
bool GetSpentIndex | ( | CSpentIndexKey & | key, |
CSpentIndexValue & | value | ||
) |
Definition at line 1041 of file validation.cpp.
Referenced by getspentinfo(), and TxToJSON().
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().
bool GetTransaction | ( | const uint256 & | hash, |
CTransaction & | txOut, | ||
const Consensus::Params & | consensusParams, | ||
uint256 & | hashBlock, | ||
bool | fAllowSlow | ||
) |
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().
Definition at line 446 of file validation.cpp.
Referenced by CMasternode::CheckCollateral(), GetUTXOHeight(), CPrivateSend::IsCollateralValid(), CTxLockRequest::IsValid(), CTxLockVote::IsValid(), CPrivateSendServer::ProcessMessage(), and CInstantSend::ResolveConflicts().
int GetUTXOConfirmations | ( | const COutPoint & | outpoint | ) |
Definition at line 461 of file validation.cpp.
Referenced by CMasternodeMan::GetNextMasternodeInQueueForPayment(), and CActiveMasternode::ManageStateLocal().
int GetUTXOHeight | ( | const COutPoint & | outpoint | ) |
Definition at line 454 of file validation.cpp.
Referenced by GetUTXOConfirmations(), CActiveMasternode::ManageStateLocal(), and CInstantSend::Vote().
std::string GetWarnings | ( | const std::string & | strFor | ) |
Format a string that describes several potential problems detected by the core. strFor can have three values:
Definition at line 4313 of file validation.cpp.
Referenced by getinfo(), getmininginfo(), getnetworkinfo(), ClientModel::getStatusBarWarnings(), and OnRPCPreCommand().
map<uint256, int64_t> mapRejectedBlocks GUARDED_BY | ( | cs_main | ) |
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().
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().
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().
|
static |
Definition at line 1418 of file validation.cpp.
Referenced by ConnectTip().
|
static |
Definition at line 1401 of file validation.cpp.
Referenced by ActivateBestChainStep(), InvalidateBlock(), and InvalidBlockFound().
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().
bool IsInitialBlockDownload | ( | ) |
Check whether we are doing an initial block download (synchronizing from disk or network)
Definition at line 1297 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), ActivateBestChain(), BitcoinMiner(), CheckForkWarningConditions(), ConnectTip(), getblocktemplate(), ClientModel::inInitialBlockDownload(), CDSNotificationInterface::InitializeCurrentBlockTip(), InvalidateBlock(), NotifyHeaderTip(), ProcessMessage(), SendMessages(), and UpdateTip().
|
static |
Returns true if there are nRequired or more blocks of minVersion or above in the last Consensus::Params::nMajorityWindow blocks, starting at pstart and going backwards.
Definition at line 3471 of file validation.cpp.
Referenced by ConnectBlock(), ContextualCheckBlock(), and ContextualCheckBlockHeader().
void LimitMempoolSize | ( | CTxMemPool & | pool, |
size_t | limit, | ||
unsigned long | age | ||
) |
Definition at line 529 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), ActivateBestChainStep(), and InvalidateBlock().
bool LoadBlockIndex | ( | ) |
Load the block tree and coins database from disk
Definition at line 3948 of file validation.cpp.
Referenced by AppInit2().
|
static |
Definition at line 3709 of file validation.cpp.
Referenced by LoadBlockIndex().
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().
|
static |
Definition at line 2781 of file validation.cpp.
Referenced by LoadExternalBlockFile(), ProcessNewBlock(), and ProcessNewBlockHeaders().
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().
FILE* OpenDiskFile | ( | const CDiskBlockPos & | pos, |
const char * | prefix, | ||
bool | fReadOnly | ||
) |
Definition at line 3653 of file validation.cpp.
Referenced by OpenBlockFile(), and 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().
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.
[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] | dbp | The already known disk position of pblock, or NULL if not yet stored. |
[out] | fNewBlock | A boolean which is set to indicate if the block was first received via this call |
Definition at line 3484 of file validation.cpp.
Referenced by generate(), ProcessBlockFound(), ProcessMessage(), and submitblock().
bool ProcessNewBlockHeaders | ( | const std::vector< CBlockHeader > & | block, |
CValidationState & | state, | ||
const CChainParams & | chainparams, | ||
CBlockIndex ** | ppindex = NULL |
||
) |
Process incoming block headers.
[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 |
Definition at line 3385 of file validation.cpp.
Referenced by ProcessMessage().
void PruneAndFlush | ( | ) |
Prune block files and flush state to disk.
Definition at line 2413 of file validation.cpp.
Referenced by AppInit2().
|
static |
Delete all entries in setBlockIndexCandidates that are worse than the current tip.
Definition at line 2694 of file validation.cpp.
Referenced by ActivateBestChainStep(), and LoadBlockIndexDB().
void PruneOneBlockFile | ( | const int | fileNumber | ) |
Definition at line 3552 of file validation.cpp.
Referenced by FindFilesToPrune().
bool ReadBlockFromDisk | ( | CBlock & | block, |
const CDiskBlockPos & | pos, | ||
const Consensus::Params & | consensusParams | ||
) |
Definition at line 1171 of file validation.cpp.
Referenced by ConnectTip(), DisconnectTip(), getblock(), GetTransaction(), gettxoutproof(), LoadExternalBlockFile(), CZMQPublishRawBlockNotifier::NotifyBlock(), ProcessGetData(), ReadBlockFromDisk(), rest_block(), CWallet::ScanForWalletTransactions(), CMasternode::UpdateLastPaid(), and CVerifyDB::VerifyDB().
bool ReadBlockFromDisk | ( | CBlock & | block, |
const CBlockIndex * | pindex, | ||
const Consensus::Params & | consensusParams | ||
) |
Definition at line 1195 of file validation.cpp.
bool ReceivedBlockTransactions | ( | const CBlock & | block, |
CValidationState & | state, | ||
CBlockIndex * | pindexNew, | ||
const CDiskBlockPos & | pos | ||
) |
Mark a block as having its data received and checked (up to BLOCK_VALID_TRANSACTIONS).
Definition at line 2971 of file validation.cpp.
Referenced by AcceptBlock(), and InitBlockIndex().
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().
void ReprocessBlocks | ( | int | nBlocks | ) |
Definition at line 2608 of file validation.cpp.
Referenced by CSporkManager::ExecuteSpork().
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().
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().
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().
void ThreadScriptCheck | ( | ) |
Run an instance of the script checking thread
Definition at line 1870 of file validation.cpp.
Referenced by AppInit2().
void UnlinkPrunedFiles | ( | std::set< int > & | setFilesToPrune | ) |
Actually unlink the specified files
Definition at line 3584 of file validation.cpp.
Referenced by FlushStateToDisk().
void UnloadBlockIndex | ( | ) |
Unload database information
Definition at line 3922 of file validation.cpp.
Referenced by AppInit2().
void UpdateCoins | ( | const CTransaction & | tx, |
CValidationState & | state, | ||
CCoinsViewCache & | inputs, | ||
CTxUndo & | txundo, | ||
int | nHeight | ||
) |
Definition at line 1427 of file validation.cpp.
Referenced by CTxMemPool::check(), ConnectBlock(), and 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.
|
static |
Update chainActive and related internal data structures.
Definition at line 2420 of file validation.cpp.
Referenced by ConnectTip(), and DisconnectTip().
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().
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().
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().
CScript COINBASE_FLAGS |
Constant stuff for coinbase transactions we create:
Definition at line 107 of file validation.cpp.
Referenced by getblocktemplate(), and IncrementExtraNonce().
CCriticalSection 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().
CWaitableCriticalSection csBestBlock |
Definition at line 67 of file validation.cpp.
Referenced by getblocktemplate().
CConditionVariable cvBlockChange |
Definition at line 68 of file validation.cpp.
Referenced by getblocktemplate(), OnRPCStopped(), and UpdateTip().
bool fAddressIndex = false |
Definition at line 73 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), ConnectBlock(), DisconnectBlock(), GetAddressIndex(), GetAddressUnspent(), InitBlockIndex(), and LoadBlockIndexDB().
bool fAlerts = DEFAULT_ALERTS |
Definition at line 85 of file validation.cpp.
Referenced by AppInit2(), and ProcessMessage().
bool fCheckBlockIndex = false |
Definition at line 81 of file validation.cpp.
Referenced by AppInit2(), and CheckBlockIndex().
bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED |
Definition at line 82 of file validation.cpp.
Referenced by AcceptBlockHeader(), AppInit2(), and TestBlockValidity().
std::atomic<bool> fDIP0001ActiveAtTip {false} |
Definition at line 89 of file validation.cpp.
Referenced by CreateNewBlock(), getblocktemplate(), CTxLockRequest::GetMinFee(), CConnman::OutboundTargetReached(), and CDSNotificationInterface::UpdatedBlockTip().
std::atomic<bool> fDIP0001WasLockedIn {false} |
Definition at line 88 of file validation.cpp.
Referenced by CMasternode::CalculateScore(), CMasternodePaymentVote::IsValid(), CMasternodePaymentVote::Relay(), and CDSNotificationInterface::UpdatedBlockTip().
bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT |
Definition at line 86 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), and AppInit2().
bool fHavePruned = false |
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().
bool fImporting = false |
Definition at line 70 of file validation.cpp.
Referenced by CImportingNow::CImportingNow(), CMasternodeBroadcast::Create(), ClientModel::getBlockSource(), CWallet::GetMasternodeOutpointAndKeys(), CWallet::GetOutpointAndKeysFromOutput(), IsInitialBlockDownload(), masternodebroadcast(), ProcessMessage(), SendMessages(), and CImportingNow::~CImportingNow().
bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG |
Definition at line 78 of file validation.cpp.
Referenced by AppInit2(), and IsStandardTx().
bool fLargeWorkForkFound = false |
Definition at line 1316 of file validation.cpp.
Referenced by CheckForkWarningConditions(), CInstantSend::GetTransactionLockSignatures(), GetWarnings(), CInstantSend::IsInstantSendReadyToLock(), and CInstantSend::IsLockedInstantSendTransaction().
bool fLargeWorkInvalidChainFound = false |
Definition at line 1317 of file validation.cpp.
Referenced by CheckForkWarningConditions(), CInstantSend::GetTransactionLockSignatures(), GetWarnings(), CInstantSend::IsInstantSendReadyToLock(), and CInstantSend::IsLockedInstantSendTransaction().
bool fPruneMode = false |
True if we're running in -prune mode.
Definition at line 77 of file validation.cpp.
Referenced by AppInit2(), FindBlockPos(), FindUndoPos(), FlushStateToDisk(), getblockchaininfo(), importaddress(), importelectrumwallet(), importprivkey(), importpubkey(), importwallet(), and ProcessMessage().
bool fReindex = false |
Definition at line 71 of file validation.cpp.
Referenced by AppInit2(), CMasternodeBroadcast::Create(), FlushStateToDisk(), ClientModel::getBlockSource(), CWallet::GetMasternodeOutpointAndKeys(), CWallet::GetOutpointAndKeysFromOutput(), InitBlockIndex(), IsInitialBlockDownload(), LoadBlockIndex(), LoadBlockIndexDB(), masternodebroadcast(), ProcessMessage(), SendMessages(), and ThreadImport().
bool fRequireStandard = true |
Definition at line 79 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), and AppInit2().
bool fSpentIndex = false |
Definition at line 75 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), ConnectBlock(), DisconnectBlock(), GetSpentIndex(), InitBlockIndex(), and LoadBlockIndexDB().
bool fTimestampIndex = false |
Definition at line 74 of file validation.cpp.
Referenced by ConnectBlock(), GetTimestampIndex(), InitBlockIndex(), and LoadBlockIndexDB().
bool fTxIndex = true |
Definition at line 72 of file validation.cpp.
Referenced by AppInit2(), ConnectBlock(), GetTransaction(), InitBlockIndex(), and LoadBlockIndexDB().
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().
class CMainCleanup instance_of_cmaincleanup |
BlockMap mapBlockIndex |
Definition at line 64 of file validation.cpp.
Referenced by AcceptBlockHeader(), AddToBlockIndex(), CWallet::AddToWallet(), AlreadyHave(), AppInit2(), CMasternodePing::CheckAndUpdate(), CheckBlockIndex(), CMasternodeBroadcast::CheckOutpoint(), ConnectBlock(), FindForkInGlobalIndex(), getblock(), getblockheader(), getblockheaders(), getblocktemplate(), getchaintips(), CMerkleTx::GetDepthInMainChain(), CWallet::GetKeyBirthTimes(), Checkpoints::GetLastCheckpoint(), GetSpendHeight(), CCoinsViewDB::GetStats(), gettxout(), gettxoutproof(), InsertBlockIndex(), invalidateblock(), InvalidateBlock(), CGovernanceObject::IsCollateralValid(), listsinceblock(), LoadBlockIndexDB(), LoadExternalBlockFile(), CWallet::MarkConflicted(), ProcessGetData(), ProcessMessage(), PruneOneBlockFile(), reconsiderblock(), ReconsiderBlock(), ReprocessBlocks(), rest_block(), rest_headers(), SendMessages(), CMerkleTx::SetMerkleBranch(), CMasternodePing::SimpleCheck(), submitblock(), CInstantSend::SyncTransaction(), CPrivateSend::SyncTransaction(), TxToJSON(), UnloadBlockIndex(), TransactionRecord::updateStatus(), verifytxoutproof(), WalletTxToJSON(), and CMainCleanup::~CMainCleanup().
CTxMemPool mempool(::minRelayTxFee) |
Referenced by CMerkleTx::AcceptToMemoryPool(), ActivateBestChainStep(), AlreadyHave(), AppInit2(), BitcoinMiner(), CPrivateSendServer::ChargeFees(), CPrivateSendServer::ChargeRandomFees(), CheckSequenceLocks(), CPrivateSendServer::CommitFinalTransaction(), ConnectTip(), CreateNewBlock(), CWallet::CreateTransaction(), DisconnectTip(), estimatefee(), estimatepriority(), estimatesmartfee(), estimatesmartpriority(), getaddressmempool(), getblocktemplate(), CMerkleTx::GetDepthInMainChain(), ClientModel::getMempoolDynamicUsage(), ClientModel::getMempoolSize(), getmininginfo(), GetSpentIndex(), GetTransaction(), gettxout(), CWalletTx::InMempool(), InvalidateBlock(), CPrivateSend::IsCollateralValid(), mempoolInfoToJSON(), mempoolToJSON(), PrepareShutdown(), prioritisetransaction(), ProcessGetData(), CPrivateSendServer::ProcessMessage(), ProcessMessage(), CWallet::ReacceptWalletTransactions(), CInstantSend::ResolveConflicts(), rest_getutxos(), CPrivateSendClient::SendDenominate(), sendrawtransaction(), signrawtransaction(), UnloadBlockIndex(), CDSNotificationInterface::UpdatedBlockTip(), CoinControlDialog::updateLabels(), SendCoinsDialog::updateSmartFeeLabel(), UpdateTip(), and WalletTxToJSON().
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_LEGACY_MIN_RELAY_TX_FEE) |
Fees smaller than this (in duffs) are considered zero fee (for relaying, mining and transaction creation)
Definition at line 94 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), AppInit2(), CreateNewBlock(), CWallet::CreateTransaction(), CTxOut::GetDustThreshold(), getinfo(), getnetworkinfo(), CWallet::GetRequiredFee(), CTxOut::IsDust(), GUIUtil::isDust(), IsStandardTx(), PaymentServer::processPaymentRequest(), CDSNotificationInterface::UpdatedBlockTip(), and CoinControlDialog::updateLabels().
unsigned int nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP |
Definition at line 80 of file validation.cpp.
Referenced by AcceptToMemoryPoolWorker(), and AppInit2().
size_t nCoinCacheUsage = 5000 * 300 |
Definition at line 83 of file validation.cpp.
Referenced by AppInit2(), FlushStateToDisk(), and CVerifyDB::VerifyDB().
uint64_t nPruneTarget = 0 |
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().
int nScriptCheckThreads = 0 |
Definition at line 69 of file validation.cpp.
Referenced by AppInit2(), and ConnectBlock().
|
static |
Definition at line 1953 of file validation.cpp.
Referenced by ConnectBlock().
|
static |
Definition at line 2528 of file validation.cpp.
Referenced by ConnectTip().
|
static |
Definition at line 1948 of file validation.cpp.
Referenced by ConnectBlock().
|
static |
Definition at line 1951 of file validation.cpp.
Referenced by ConnectBlock().
|
static |
Definition at line 2526 of file validation.cpp.
Referenced by ConnectTip().
|
static |
Definition at line 2527 of file validation.cpp.
Referenced by ConnectTip().
|
static |
Definition at line 1949 of file validation.cpp.
Referenced by ConnectBlock().
|
static |
Definition at line 1952 of file validation.cpp.
Referenced by ConnectBlock().
|
static |
Definition at line 2529 of file validation.cpp.
Referenced by ConnectTip().
|
static |
Definition at line 2525 of file validation.cpp.
Referenced by ConnectTip().
|
static |
Definition at line 1954 of file validation.cpp.
Referenced by ConnectTip().
|
static |
Definition at line 1950 of file validation.cpp.
Referenced by ConnectBlock().
CBlockTreeDB* pblocktree = NULL |
Global variable that points to the active block tree (protected by cs_main)
Definition at line 188 of file validation.cpp.
Referenced by AppInit2(), ConnectBlock(), DisconnectBlock(), FlushStateToDisk(), GetAddressIndex(), GetAddressUnspent(), GetSpentIndex(), GetTimestampIndex(), GetTransaction(), InitBlockIndex(), LoadBlockIndexDB(), PrepareShutdown(), and ThreadImport().
CCoinsViewCache* pcoinsTip = NULL |
Global variable that points to the active CCoinsView (protected by cs_main)
Definition at line 187 of file validation.cpp.
Referenced by AcceptToMemoryPool(), AcceptToMemoryPoolWorker(), ActivateBestChainStep(), AlreadyHave(), AppInit2(), CheckSequenceLocks(), ConnectTip(), DisconnectTip(), FlushStateToDisk(), GetTransaction(), gettxout(), gettxoutproof(), gettxoutsetinfo(), GetUTXOCoins(), InvalidateBlock(), LimitMempoolSize(), LoadBlockIndexDB(), PrepareShutdown(), ProcessMessage(), rest_getutxos(), sendrawtransaction(), signrawtransaction(), TestBlockValidity(), TransactionDesc::toHTML(), UpdateTip(), verifychain(), and CVerifyDB::VerifyDB().
CBlockIndex * pindexBestForkBase = NULL |
Definition at line 1318 of file validation.cpp.
Referenced by CheckForkWarningConditions(), and CheckForkWarningConditionsOnNewFork().
CBlockIndex* pindexBestForkTip = NULL |
Definition at line 1318 of file validation.cpp.
Referenced by CheckForkWarningConditions(), and CheckForkWarningConditionsOnNewFork().
CBlockIndex* pindexBestHeader = NULL |
Best header we've seen so far (used for getheaders queries' starting points).
Definition at line 66 of file validation.cpp.
Referenced by AddToBlockIndex(), ConnectBlock(), getblockchaininfo(), ClientModel::getHeaderTipHeight(), ClientModel::getHeaderTipTime(), LoadBlockIndexDB(), CMasternodeSync::NotifyHeaderTip(), NotifyHeaderTip(), ProcessGetData(), ProcessMessage(), SendMessages(), UnloadBlockIndex(), and CMasternodeSync::UpdatedBlockTip().
|
static |
Referenced by ConnectBlock(), and ThreadScriptCheck().
const string strMessageMagic = "DarkCoin Signed Message:\n" |
Definition at line 109 of file validation.cpp.
Referenced by SignVerifyMessageDialog::on_signMessageButton_SM_clicked(), SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked(), CMessageSigner::SignMessage(), signmessage(), CMessageSigner::VerifyMessage(), and verifymessage().
VersionBitsCache versionbitscache |
Definition at line 1876 of file validation.cpp.
Referenced by ComputeBlockVersion(), ConnectBlock(), ContextualCheckBlock(), ContextualCheckTransaction(), getblocktemplate(), UnloadBlockIndex(), CDSNotificationInterface::UpdatedBlockTip(), and VersionBitsTipState().
|
static |
Definition at line 1946 of file validation.cpp.
Referenced by UnloadBlockIndex(), and UpdateTip().