PRCYCoin  2.0.0.7rc1
P2P Digital Currency
Classes | Typedefs | Functions | Variables
main.h File Reference
#include "amount.h"
#include "chain.h"
#include "chainparams.h"
#include "coins.h"
#include "consensus/validation.h"
#include "net.h"
#include "poa.h"
#include "primitives/block.h"
#include "primitives/transaction.h"
#include "script/script.h"
#include "script/sigcache.h"
#include "script/standard.h"
#include "sync.h"
#include "tinyformat.h"
#include "txmempool.h"
#include "uint256.h"
#include "undo.h"
#include "bignum.h"
#include <algorithm>
#include <exception>
#include <map>
#include <set>
#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
#include <boost/unordered_map.hpp>
#include "secp256k1_bulletproofs.h"
#include "secp256k1_commitment.h"
#include "secp256k1_generator.h"
#include "secp256k1.h"
#include "secp256k1-mw/src/hash_impl.h"
Include dependency graph for main.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  BlockHasher
 
struct  CNodeStateStats
 
class  CScriptCheck
 Closure representing one script verification Note that this stores references to the spending transaction. More...
 
class  CVerifyDB
 RAII wrapper for VerifyDB: Verify consistency of the block and coin databases. More...
 

Typedefs

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

Functions

void RegisterNodeSignals (CNodeSignals &nodeSignals)
 Register with a network node to receive its signals. More...
 
void UnregisterNodeSignals (CNodeSignals &nodeSignals)
 Unregister a network node. More...
 
secp256k1_context2GetContext ()
 
secp256k1_scratch_space2GetScratch ()
 
secp256k1_bulletproof_generatorsGetGenerator ()
 
bool VerifyBulletProofAggregate (const CTransaction &tx)
 
bool VerifyRingSignatureWithTxFee (const CTransaction &tx, CBlockIndex *pindex)
 
void DestroyContext ()
 
bool VerifyDerivedAddress (const CTxOut &out, std::string stealth)
 
bool ReVerifyPoSBlock (CBlockIndex *pindex)
 
bool ProcessNewBlock (CValidationState &state, CNode *pfrom, CBlock *pblock, CDiskBlockPos *dbp=NULL)
 Process an incoming block. More...
 
bool CheckDiskSpace (uint64_t nAdditionalBytes=0)
 Check whether enough disk space is available for an incoming block. More...
 
FILE * OpenBlockFile (const CDiskBlockPos &pos, bool fReadOnly=false)
 Open a block file (blk?????.dat) More...
 
FILE * OpenUndoFile (const CDiskBlockPos &pos, bool fReadOnly=false)
 Open an undo file (rev?????.dat) More...
 
fs::path GetBlockPosFilename (const CDiskBlockPos &pos, const char *prefix)
 Translation to a filesystem path. More...
 
bool LoadExternalBlockFile (FILE *fileIn, CDiskBlockPos *dbp=NULL)
 Import blocks from an external file. More...
 
bool InitBlockIndex ()
 Initialize a new block tree database + block data on disk. More...
 
bool LoadBlockIndex (std::string &strError)
 Load the block tree and coins database from disk. More...
 
void UnloadBlockIndex ()
 Unload database information. More...
 
int ActiveProtocol ()
 See whether the protocol update is enforced for connected nodes. More...
 
bool ProcessMessages (CNode *pfrom)
 Process protocol messages received from a given node. More...
 
bool VerifyZeroBlindCommitment (const CTxOut &out)
 
bool SendMessages (CNode *pto)
 Send queued protocol messages to be sent to a give node. More...
 
void ThreadScriptCheck ()
 Run an instance of the script checking thread. More...
 
bool IsInitialBlockDownload ()
 Check whether we are doing an initial block download (synchronizing from disk or network) More...
 
std::string GetWarnings (std::string strFor)
 Format a string that describes several potential problems detected by the core. More...
 
bool GetTransaction (const uint256 &hash, CTransaction &tx, uint256 &hashBlock, bool fAllowSlow=false, CBlockIndex *blockIndex=nullptr)
 Retrieve a transaction (from memory pool, or from disk, if possible) More...
 
bool CheckHaveInputs (const CCoinsViewCache &view, const CTransaction &tx)
 Find the best known block, and make it the tip of the block chain. More...
 
double ConvertBitsToDouble (unsigned int nBits)
 
int64_t GetMasternodePayment (int nHeight, int64_t blockValue, int nMasternodeCount=0)
 
unsigned int GetNextWorkRequired (const CBlockIndex *pindexLast, const CBlockHeader *pblock, bool fProofOfStake)
 
bool ActivateBestChain (CValidationState &state, CBlock *pblock=NULL, bool fAlreadyChecked=false)
 Make the best chain active, in multiple steps. More...
 
CAmount GetBlockValue (int nHeight)
 
void RemoveInvalidTransactionsFromMempool ()
 
void SetRingSize (int nHeight)
 
CBlockIndexInsertBlockIndex (uint256 hash)
 Create a new block index entry for a given block hash. More...
 
bool GetNodeStateStats (NodeId nodeid, CNodeStateStats &stats)
 Get statistics from node state. More...
 
void Misbehaving (NodeId nodeid, int howmuch) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 Increase a node's misbehavior score. More...
 
void FlushStateToDisk ()
 Flush all state, indexes and buffers to disk. More...
 
CAmount GetValueIn (CCoinsViewCache view, const CTransaction &tx)
 
bool AcceptToMemoryPool (CTxMemPool &pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, bool *pfMissingInputs, bool fRejectInsaneFee=false, bool ignoreFees=false)
 (try to) add transaction to memory pool More...
 
bool AcceptableInputs (CTxMemPool &pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, bool *pfMissingInputs, bool fRejectInsaneFee=false, bool isDSTX=false)
 
bool IsSpentKeyImage (const std::string &kiHex, const uint256 &againsHash)
 
bool CheckKeyImageSpendInMainChain (const std::string &kiHex, int &confirmations)
 
double GetPriority (const CTransaction &tx, int nHeight)
 Return priority of tx at height nHeight. More...
 
uint256 GetTxSignatureHash (const CTransaction &tx)
 
uint256 GetTxInSignatureHash (const CTxIn &txin)
 
bool VerifyShnorrKeyImageTx (const CTransaction &tx)
 
bool VerifyShnorrKeyImageTxIn (const CTxIn &txin, uint256 sigHash)
 
int GetInputAge (CTxIn &vin)
 
int GetIXConfirmations (uint256 nTXHash)
 
CAmount GetMinRelayFee (const CTransaction &tx, unsigned int nBytes, bool fAllowFree)
 
bool AreInputsStandard (const CTransaction &tx, const CCoinsViewCache &mapInputs)
 Check transaction inputs, and make sure any pay-to-script-hash transactions are evaluating IsStandard scripts. More...
 
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. More...
 
void UpdateCoins (const CTransaction &tx, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight)
 Apply the effects of this transaction on the UTXO set represented by view. More...
 
bool IsTransactionInChain (const uint256 &txId, int &nHeightTx, CTransaction &tx)
 Context-independent validity checks. More...
 
bool IsTransactionInChain (const uint256 &txId, int &nHeightTx)
 
bool IsBlockHashInChain (const uint256 &hashBlock)
 
bool ValidOutPoint (const COutPoint out, int nHeight=1)
 
bool RecalculatePRCYSupply (int nHeightStart)
 
bool CheckFinalTx (const CTransaction &tx, int flags=-1)
 Check if transaction will be final in the next block to be created. More...
 
bool IsStandardTx (const CTransaction &tx, std::string &reason)
 Check for standard transaction types. More...
 
bool WriteBlockToDisk (CBlock &block, CDiskBlockPos &pos)
 Functions for disk access for blocks. More...
 
bool ReadBlockFromDisk (CBlock &block, const CDiskBlockPos &pos)
 
bool ReadBlockFromDisk (CBlock &block, const CBlockIndex *pindex)
 
bool DisconnectBlock (CBlock &block, CValidationState &state, CBlockIndex *pindex, CCoinsViewCache &coins, bool *pfClean=NULL)
 Functions for validating blocks and updating the block tree. More...
 
bool DisconnectBlocks (int nBlocks)
 Reprocess a number of blocks to try and get on the correct chain again. More...
 
void ReprocessBlocks (int nBlocks)
 
bool ConnectBlock (const CBlock &block, CValidationState &state, CBlockIndex *pindex, CCoinsViewCache &coins, bool fJustCheck, bool fAlreadyChecked=false)
 Apply the effects of this block (with given index) on the UTXO set represented by coins. More...
 
bool CheckBlockHeader (const CBlockHeader &block, CValidationState &state, bool fCheckPOW=true)
 Context-independent validity checks. More...
 
bool CheckBlock (const CBlock &block, CValidationState &state, bool fCheckPOW=true, bool fCheckMerkleRoot=true, bool fCheckSig=true)
 
bool CheckWork (const CBlock block, CBlockIndex *const pindexPrev)
 
bool ContextualCheckBlockHeader (const CBlockHeader &block, CValidationState &state, CBlockIndex *pindexPrev)
 Context-dependent validity checks. More...
 
bool ContextualCheckBlock (const CBlock &block, CValidationState &state, CBlockIndex *pindexPrev)
 
bool TestBlockValidity (CValidationState &state, 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) More...
 
bool AcceptBlock (CBlock &block, CValidationState &state, CBlockIndex **pindex, CDiskBlockPos *dbp=NULL, bool fAlreadyCheckedBlock=false)
 Store block on disk. More...
 
bool AcceptBlockHeader (const CBlockHeader &block, CValidationState &state, CBlockIndex **ppindex=NULL)
 
CBlockIndexFindForkInGlobalIndex (const CChain &chain, const CBlockLocator &locator)
 Find the last common block between the parameter chain and a locator. More...
 
bool InvalidateBlock (CValidationState &state, CBlockIndex *pindex)
 Mark a block as invalid. More...
 
bool ReconsiderBlock (CValidationState &state, CBlockIndex *pindex)
 Remove invalidity status from a block and its descendants. More...
 

Variables

CScript COINBASE_FLAGS
 Constant stuff for coinbase transactions we create: More...
 
RecursiveMutex cs_main
 Global state. More...
 
CTxMemPool mempool
 
BlockMap mapBlockIndex
 
uint64_t nLastBlockTx
 
uint64_t nLastBlockSize
 
const std::string strMessageMagic
 
int64_t nTimeBestReceived
 
Mutex g_best_block_mutex
 
std::condition_variable g_best_block_cv
 
uint256 g_best_block
 
std::atomic< bool > fImporting
 
std::atomic< bool > fReindex
 
int nScriptCheckThreads
 
bool fTxIndex
 
bool fIsBareMultisigStd
 
bool fCheckBlockIndex
 
size_t nCoinCacheUsage
 
CFeeRate minRelayTxFee
 Fees smaller than this (in duffs) are considered zero fee (for relaying and mining) 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...
 
int64_t nMaxTipAge
 
bool fVerifyingBlocks
 
bool fGeneratePrcycoins
 
bool fLargeWorkForkFound
 
bool fLargeWorkInvalidChainFound
 
int64_t nLastCoinStakeSearchInterval
 
int64_t nLastCoinStakeSearchTime
 
int MIN_RING_SIZE
 
int MAX_RING_SIZE
 
const int MAX_TX_INPUTS
 
const int MIN_TX_INPUTS_FOR_SWEEPING
 
std::map< uint256, int64_t > mapRejectedBlocks
 
std::map< unsigned int, unsigned int > mapHashedBlocks
 
std::map< COutPoint, COutPointmapInvalidOutPoints
 
CBlockIndexpindexBestHeader
 Best header we've seen so far (used for getheaders queries' starting points). More...
 
CChain chainActive
 The currently-connected chain of blocks. More...
 
CCoinsViewCachepcoinsTip
 Global variable that points to the active CCoinsView (protected by cs_main) More...
 
CBlockTreeDBpblocktree
 Global variable that points to the active block tree (protected by cs_main) More...
 

Typedef Documentation

◆ BlockMap

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

Definition at line 134 of file main.h.

Function Documentation

◆ AcceptableInputs()

bool AcceptableInputs ( CTxMemPool pool,
CValidationState state,
const CTransaction tx,
bool  fLimitFree,
bool *  pfMissingInputs,
bool  fRejectInsaneFee = false,
bool  isDSTX = false 
)
Todo:
: @campv need to recompute the fee

Definition at line 1803 of file main.cpp.

Here is the call graph for this function:

◆ AcceptBlock()

bool AcceptBlock ( CBlock block,
CValidationState state,
CBlockIndex **  pindex,
CDiskBlockPos dbp = NULL,
bool  fAlreadyCheckedBlock = false 
)

Store block on disk.

If dbp is provided, the file is known to already reside on disk

Todo:
: deal better with duplicate blocks.
Todo:
: Remove this chain from disk.

Definition at line 4639 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AcceptBlockHeader()

bool AcceptBlockHeader ( const CBlockHeader block,
CValidationState state,
CBlockIndex **  ppindex = NULL 
)

◆ AcceptToMemoryPool()

bool AcceptToMemoryPool ( CTxMemPool pool,
CValidationState state,
const CTransaction tx,
bool  fLimitFree,
bool *  pfMissingInputs,
bool  fRejectInsaneFee = false,
bool  ignoreFees = false 
)

(try to) add transaction to memory pool

Definition at line 1579 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ActivateBestChain()

bool ActivateBestChain ( CValidationState state,
CBlock pblock,
bool  fAlreadyChecked 
)

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 3892 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ActiveProtocol()

int ActiveProtocol ( )

See whether the protocol update is enforced for connected nodes.

Definition at line 6844 of file main.cpp.

Here is the caller graph for this function:

◆ AreInputsStandard()

bool AreInputsStandard ( const CTransaction tx,
const CCoinsViewCache mapInputs 
)

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 for standard transaction types

Parameters
[in]mapInputsMap of previous transactions that have outputs we're spending
Returns
True if all inputs (scriptSigs) use only standard transaction forms

Check transaction inputs, and make sure any pay-to-script-hash transactions are evaluating IsStandard scripts.

  1. scriptSigs with extra data stuffed into them, not consumed by scriptPubKey (or P2SH script)
  2. P2SH scripts with a crazy number of expensive CHECKSIG/CHECKMULTISIG operations

Definition at line 1309 of file main.cpp.

Here is the call graph for this function:

◆ CheckBlock()

bool CheckBlock ( const CBlock block,
CValidationState state,
bool  fCheckPOW = true,
bool  fCheckMerkleRoot = true,
bool  fCheckSig = true 
)
Todo:
Audit checkblock

Definition at line 4263 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckBlockHeader()

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

Context-independent validity checks.

Definition at line 4237 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckDiskSpace()

bool CheckDiskSpace ( uint64_t  nAdditionalBytes = 0)

Check whether enough disk space is available for an incoming block.

Definition at line 5116 of file main.cpp.

Here is the call graph for this function:

◆ CheckFinalTx()

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 1465 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckHaveInputs()

bool CheckHaveInputs ( const CCoinsViewCache view,
const CTransaction tx 
)

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

Definition at line 1521 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 2766 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckKeyImageSpendInMainChain()

bool CheckKeyImageSpendInMainChain ( const std::string &  kiHex,
int &  confirmations 
)

Definition at line 320 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckWork()

bool CheckWork ( const CBlock  block,
CBlockIndex *const  pindexPrev 
)

Definition at line 4437 of file main.cpp.

Here is the call graph for this function:

◆ ConnectBlock()

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

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

@Audit ConnectBlock

Definition at line 3085 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ContextualCheckBlock()

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

Definition at line 4545 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ContextualCheckBlockHeader()

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

Context-dependent validity checks.

Definition at line 4458 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConvertBitsToDouble()

double ConvertBitsToDouble ( unsigned int  nBits)
Todo:
***

Definition at line 2139 of file main.cpp.

Here is the caller graph for this function:

◆ DestroyContext()

void DestroyContext ( )

Definition at line 369 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DisconnectBlock()

bool DisconnectBlock ( CBlock block,
CValidationState state,
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 2877 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DisconnectBlocks()

bool DisconnectBlocks ( int  nBlocks)

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

Definition at line 3647 of file main.cpp.

Here is the caller graph for this function:

◆ FindForkInGlobalIndex()

CBlockIndex* FindForkInGlobalIndex ( const CChain chain,
const CBlockLocator locator 
)

Find the last common block between the parameter chain and a locator.

Definition at line 1115 of file main.cpp.

Here is the call graph for this function:

◆ FlushStateToDisk()

void FlushStateToDisk ( )

Flush all state, indexes and buffers to disk.

Definition at line 3467 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBlockPosFilename()

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

Translation to a filesystem path.

Definition at line 5160 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBlockValue()

CAmount GetBlockValue ( int  nHeight)

Definition at line 2158 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetContext()

secp256k1_context2* GetContext ( )

Definition at line 348 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetGenerator()

Definition at line 362 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetInputAge()

int GetInputAge ( CTxIn vin)

Definition at line 1373 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetIXConfirmations()

int GetIXConfirmations ( uint256  nTXHash)

Definition at line 1392 of file main.cpp.

Here is the caller graph for this function:

◆ GetMasternodePayment()

int64_t GetMasternodePayment ( int  nHeight,
int64_t  blockValue,
int  nMasternodeCount = 0 
)

Definition at line 2454 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMinRelayFee()

CAmount GetMinRelayFee ( const CTransaction tx,
unsigned int  nBytes,
bool  fAllowFree 
)

Definition at line 1495 of file main.cpp.

Here is the call graph for this function:

◆ GetNextWorkRequired()

unsigned int GetNextWorkRequired ( const CBlockIndex pindexLast,
const CBlockHeader pblock,
bool  fProofOfStake 
)
Here is the caller graph for this function:

◆ GetNodeStateStats()

bool GetNodeStateStats ( NodeId  nodeid,
CNodeStateStats stats 
)

Get statistics from node state.

Definition at line 1081 of file main.cpp.

Here is the caller graph for this function:

◆ GetPriority()

double GetPriority ( const CTransaction tx,
int  nHeight 
)

Return priority of tx at height nHeight.

Definition at line 259 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetScratch()

secp256k1_scratch_space2* GetScratch ( )

Definition at line 355 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTransaction()

bool GetTransaction ( const uint256 hash,
CTransaction txOut,
uint256 hashBlock,
bool  fAllowSlow,
CBlockIndex blockIndex 
)

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

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

Definition at line 2010 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTxInSignatureHash()

uint256 GetTxInSignatureHash ( const CTxIn txin)

Definition at line 687 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTxSignatureHash()

uint256 GetTxSignatureHash ( const CTransaction tx)

Definition at line 681 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetValueIn()

CAmount GetValueIn ( CCoinsViewCache  view,
const CTransaction tx 
)

Definition at line 221 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetWarnings()

std::string GetWarnings ( std::string  strFor)

Format a string that describes several potential problems detected by the core.

Definition at line 5739 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitBlockIndex()

bool InitBlockIndex ( )

Initialize a new block tree database + block data on disk.

Definition at line 5425 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InsertBlockIndex()

CBlockIndex* InsertBlockIndex ( uint256  hash)

Create a new block index entry for a given block hash.

Definition at line 5165 of file main.cpp.

Here is the call graph for this function:

◆ InvalidateBlock()

bool InvalidateBlock ( CValidationState state,
CBlockIndex pindex 
)

Mark a block as invalid.

Definition at line 3972 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsBlockHashInChain()

bool IsBlockHashInChain ( const uint256 hashBlock)

Definition at line 4519 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsInitialBlockDownload()

bool IsInitialBlockDownload ( )

Check whether we are doing an initial block download (synchronizing from disk or network)

Definition at line 2500 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsSpentKeyImage()

bool IsSpentKeyImage ( const std::string &  kiHex,
const uint256 againsHash 
)

Definition at line 283 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsStandardTx()

bool IsStandardTx ( const CTransaction tx,
std::string &  reason 
)

Check for standard transaction types.

Returns
True if all outputs (scriptPubKeys) use only standard transaction forms

Definition at line 1213 of file main.cpp.

Here is the call graph for this function:

◆ IsTransactionInChain() [1/2]

bool IsTransactionInChain ( const uint256 txId,
int &  nHeightTx 
)

Definition at line 4539 of file main.cpp.

Here is the call graph for this function:

◆ IsTransactionInChain() [2/2]

bool IsTransactionInChain ( const uint256 txId,
int &  nHeightTx,
CTransaction tx 
)

Context-independent validity checks.

Definition at line 4527 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadBlockIndex()

bool LoadBlockIndex ( std::string &  strError)

Load the block tree and coins database from disk.

Definition at line 5416 of file main.cpp.

◆ LoadExternalBlockFile()

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

Import blocks from an external file.

Definition at line 5467 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Misbehaving()

void Misbehaving ( NodeId  nodeid,
int  howmuch 
)

Increase a node's misbehavior score.

Definition at line 2645 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OpenBlockFile()

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

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

Definition at line 5150 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OpenUndoFile()

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

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

Definition at line 5155 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessMessages()

bool ProcessMessages ( CNode pfrom)

Process protocol messages received from a given node.

Definition at line 6849 of file main.cpp.

Here is the caller graph for this function:

◆ ProcessNewBlock()

bool ProcessNewBlock ( CValidationState state,
CNode pfrom,
CBlock pblock,
CDiskBlockPos dbp = NULL 
)

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!

Parameters
[out]stateThis may be set to an Error state if any error occurred processing it, including during validation/connection/etc of otherwise unrelated blocks during reorganisation; or it may be set to an Invalid state if pblock is itself invalid (but this is not guaranteed even when the block is checked). If you want to possibly get feedback on whether pblock is valid, you must also install a CValidationInterface - this will have its BlockChecked method called whenever any block completes validation.
[in]pfromThe node which we are receiving the block from; it is added to mapBlockSource and may be penalised if the block is invalid.
[in]pblockThe block we want to process.
[out]dbpIf pblock is stored to disk (or already there), this will be set to its location.
Returns
True if state.IsValid()

Definition at line 4890 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadBlockFromDisk() [1/2]

bool ReadBlockFromDisk ( CBlock block,
const CBlockIndex pindex 
)

Definition at line 2126 of file main.cpp.

Here is the call graph for this function:

◆ ReadBlockFromDisk() [2/2]

bool ReadBlockFromDisk ( CBlock block,
const CDiskBlockPos pos 
)

Definition at line 2101 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RecalculatePRCYSupply()

bool RecalculatePRCYSupply ( int  nHeightStart)

Definition at line 3002 of file main.cpp.

Here is the call graph for this function:

◆ ReconsiderBlock()

bool ReconsiderBlock ( CValidationState state,
CBlockIndex pindex 
)

Remove invalidity status from a block and its descendants.

Definition at line 4008 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterNodeSignals()

void RegisterNodeSignals ( CNodeSignals nodeSignals)

Register with a network node to receive its signals.

Definition at line 1097 of file main.cpp.

Here is the call graph for this function:

◆ RemoveInvalidTransactionsFromMempool()

void RemoveInvalidTransactionsFromMempool ( )

Definition at line 3691 of file main.cpp.

Here is the call graph for this function:

◆ ReprocessBlocks()

void ReprocessBlocks ( int  nBlocks)

Definition at line 3660 of file main.cpp.

Here is the call graph for this function:

◆ ReVerifyPoSBlock()

bool ReVerifyPoSBlock ( CBlockIndex pindex)

Definition at line 621 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendMessages()

bool SendMessages ( CNode pto)

Send queued protocol messages to be sent to a give node.

Parameters
[in]ptoThe node which we are sending messages to.

Definition at line 6948 of file main.cpp.

Here is the caller graph for this function:

◆ SetRingSize()

void SetRingSize ( int  nHeight)

Definition at line 2466 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TestBlockValidity()

bool TestBlockValidity ( CValidationState state,
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 5088 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ThreadScriptCheck()

void ThreadScriptCheck ( )

Run an instance of the script checking thread.

Definition at line 2996 of file main.cpp.

Here is the call graph for this function:

◆ UnloadBlockIndex()

void UnloadBlockIndex ( )

Unload database information.

Definition at line 5386 of file main.cpp.

Here is the call graph for this function:

◆ UnregisterNodeSignals()

void UnregisterNodeSignals ( CNodeSignals nodeSignals)

Unregister a network node.

Definition at line 1106 of file main.cpp.

Here is the call graph for this function:

◆ UpdateCoins()

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

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

Definition at line 2706 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ValidOutPoint()

bool ValidOutPoint ( const COutPoint  out,
int  nHeight = 1 
)

Definition at line 2741 of file main.cpp.

Here is the call graph for this function:

◆ VerifyBulletProofAggregate()

bool VerifyBulletProofAggregate ( const CTransaction tx)

Definition at line 376 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VerifyDerivedAddress()

bool VerifyDerivedAddress ( const CTxOut out,
std::string  stealth 
)

Definition at line 2549 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VerifyRingSignatureWithTxFee()

bool VerifyRingSignatureWithTxFee ( const CTransaction tx,
CBlockIndex pindex 
)

Definition at line 393 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VerifyShnorrKeyImageTx()

bool VerifyShnorrKeyImageTx ( const CTransaction tx)

Definition at line 1454 of file main.cpp.

Here is the call graph for this function:

◆ VerifyShnorrKeyImageTxIn()

bool VerifyShnorrKeyImageTxIn ( const CTxIn txin,
uint256  sigHash 
)

Definition at line 1407 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VerifyZeroBlindCommitment()

bool VerifyZeroBlindCommitment ( const CTxOut out)

Definition at line 2540 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteBlockToDisk()

bool WriteBlockToDisk ( CBlock block,
CDiskBlockPos pos 
)

Functions for disk access for blocks.

Definition at line 2080 of file main.cpp.

Here is the call graph for this function:

Variable Documentation

◆ chainActive

CChain chainActive

The currently-connected chain of blocks.

Definition at line 70 of file main.cpp.

◆ COINBASE_FLAGS

CScript COINBASE_FLAGS

Constant stuff for coinbase transactions we create:

Definition at line 117 of file main.cpp.

◆ cs_main

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 65 of file main.cpp.

◆ fCheckBlockIndex

bool fCheckBlockIndex

Definition at line 84 of file main.cpp.

◆ fGeneratePrcycoins

bool fGeneratePrcycoins

◆ fImporting

std::atomic<bool> fImporting

Definition at line 80 of file main.cpp.

◆ fIsBareMultisigStd

bool fIsBareMultisigStd

Definition at line 83 of file main.cpp.

◆ fLargeWorkForkFound

bool fLargeWorkForkFound

Definition at line 2516 of file main.cpp.

◆ fLargeWorkInvalidChainFound

bool fLargeWorkInvalidChainFound

Definition at line 2517 of file main.cpp.

◆ fReindex

std::atomic<bool> fReindex

Definition at line 81 of file main.cpp.

◆ fTxIndex

bool fTxIndex

Definition at line 82 of file main.cpp.

◆ fVerifyingBlocks

bool fVerifyingBlocks

Definition at line 85 of file main.cpp.

◆ g_best_block

uint256 g_best_block

Definition at line 77 of file main.cpp.

◆ g_best_block_cv

std::condition_variable g_best_block_cv

Definition at line 76 of file main.cpp.

◆ g_best_block_mutex

Mutex g_best_block_mutex

Definition at line 75 of file main.cpp.

◆ mapBlockIndex

BlockMap mapBlockIndex

Definition at line 67 of file main.cpp.

◆ mapHashedBlocks

std::map<unsigned int, unsigned int> mapHashedBlocks

Definition at line 69 of file main.cpp.

◆ mapInvalidOutPoints

std::map<COutPoint, COutPoint> mapInvalidOutPoints

Definition at line 2735 of file main.cpp.

◆ mapRejectedBlocks

std::map<uint256, int64_t> mapRejectedBlocks

Definition at line 110 of file main.cpp.

◆ MAX_RING_SIZE

int MAX_RING_SIZE

Definition at line 92 of file main.cpp.

◆ MAX_TX_INPUTS

const int MAX_TX_INPUTS

Definition at line 93 of file main.cpp.

◆ mempool

CTxMemPool mempool

◆ MIN_RING_SIZE

int MIN_RING_SIZE

Definition at line 91 of file main.cpp.

◆ MIN_TX_INPUTS_FOR_SWEEPING

const int MIN_TX_INPUTS_FOR_SWEEPING

Definition at line 94 of file main.cpp.

◆ minRelayTxFee

CFeeRate minRelayTxFee

Fees smaller than this (in duffs) are considered zero fee (for relaying and mining) 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 100 of file main.cpp.

◆ nCoinCacheUsage

size_t nCoinCacheUsage

Definition at line 86 of file main.cpp.

◆ nLastBlockSize

uint64_t nLastBlockSize

Definition at line 66 of file miner.cpp.

◆ nLastBlockTx

uint64_t nLastBlockTx

Definition at line 65 of file miner.cpp.

◆ nLastCoinStakeSearchInterval

int64_t nLastCoinStakeSearchInterval

Definition at line 67 of file miner.cpp.

◆ nLastCoinStakeSearchTime

int64_t nLastCoinStakeSearchTime

◆ nMaxTipAge

int64_t nMaxTipAge

Definition at line 89 of file main.cpp.

◆ nScriptCheckThreads

int nScriptCheckThreads

Definition at line 79 of file main.cpp.

◆ nTimeBestReceived

int64_t nTimeBestReceived

Definition at line 72 of file main.cpp.

◆ pblocktree

CBlockTreeDB* pblocktree

Global variable that points to the active block tree (protected by cs_main)

Definition at line 1131 of file main.cpp.

◆ pcoinsTip

CCoinsViewCache* pcoinsTip

Global variable that points to the active CCoinsView (protected by cs_main)

Definition at line 1130 of file main.cpp.

◆ pindexBestHeader

CBlockIndex* pindexBestHeader

Best header we've seen so far (used for getheaders queries' starting points).

Definition at line 71 of file main.cpp.

◆ strMessageMagic

const std::string strMessageMagic

Definition at line 119 of file main.cpp.