PIVX Core  5.6.99
P2P Digital Currency
Classes | Enumerations | Functions
chain.h File Reference
#include "chainparams.h"
#include "flatfile.h"
#include "optional.h"
#include "primitives/block.h"
#include "timedata.h"
#include "tinyformat.h"
#include "uint256.h"
#include "util/system.h"
#include "libzerocoin/Denominations.h"
#include <vector>
Include dependency graph for chain.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CBlockFileInfo
 
class  CBlockIndex
 The block chain is a tree shaped structure starting with the genesis block at the root, with each block potentially having multiple candidates to be the next block. More...
 
class  CDiskBlockIndex
 
class  CChain
 An in-memory indexed chain of blocks. More...
 

Enumerations

enum  BlockStatus {
  BLOCK_VALID_UNKNOWN = 0 , BLOCK_VALID_HEADER = 1 , BLOCK_VALID_TREE = 2 , BLOCK_VALID_TRANSACTIONS = 3 ,
  BLOCK_VALID_CHAIN = 4 , BLOCK_VALID_SCRIPTS = 5 , BLOCK_VALID_MASK , BLOCK_HAVE_DATA = 8 ,
  BLOCK_HAVE_UNDO = 16 , BLOCK_HAVE_MASK = BLOCK_HAVE_DATA | BLOCK_HAVE_UNDO , BLOCK_FAILED_VALID = 32 , BLOCK_FAILED_CHILD = 64 ,
  BLOCK_FAILED_MASK = BLOCK_FAILED_VALID | BLOCK_FAILED_CHILD
}
 
enum  { BLOCK_PROOF_OF_STAKE = (1 << 0) , BLOCK_STAKE_ENTROPY = (1 << 1) , BLOCK_STAKE_MODIFIER = (1 << 2) }
 

Functions

const CBlockIndexLastCommonAncestor (const CBlockIndex *pa, const CBlockIndex *pb)
 Find the forking point between two chain tips. More...
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BLOCK_PROOF_OF_STAKE 
BLOCK_STAKE_ENTROPY 
BLOCK_STAKE_MODIFIER 

Definition at line 127 of file chain.h.

◆ BlockStatus

Enumerator
BLOCK_VALID_UNKNOWN 

Unused.

BLOCK_VALID_HEADER 

Parsed, version ok, hash satisfies claimed PoW, 1 <= vtx count <= max, timestamp not in future.

BLOCK_VALID_TREE 

All parent headers found, difficulty matches, timestamp >= median previous, checkpoint.

Implies all parents are also at least TREE.

BLOCK_VALID_TRANSACTIONS 

Only first tx is coinbase, 2 <= coinbase input script length <= 100, transactions valid, no duplicate txids, sigops, size, merkle root.

Implies all parents are at least TREE but not necessarily TRANSACTIONS. When all parent blocks also have TRANSACTIONS, CBlockIndex::nChainTx will be set.

BLOCK_VALID_CHAIN 

Outputs do not overspend inputs, no double spends, coinbase output ok, immature coinbase spends.

Implies all parents are also at least CHAIN.

BLOCK_VALID_SCRIPTS 

Scripts & signatures ok. Implies all parents are also at least SCRIPTS.

BLOCK_VALID_MASK 

All validity bits.

BLOCK_HAVE_DATA 
BLOCK_HAVE_UNDO 

full block available in blk*.dat

BLOCK_HAVE_MASK 

undo data available in rev*.dat

BLOCK_FAILED_VALID 
BLOCK_FAILED_CHILD 

stage after last reached validness failed

BLOCK_FAILED_MASK 

descends from failed block

Definition at line 87 of file chain.h.

Function Documentation

◆ LastCommonAncestor()

const CBlockIndex* LastCommonAncestor ( const CBlockIndex pa,
const CBlockIndex pb 
)

Find the forking point between two chain tips.

Find the forking point between two chain tips.

Both pa and pb must be non-nullptr.

Definition at line 337 of file chain.cpp.

Here is the call graph for this function: