5#ifndef BITCOIN_BLOCKINDEX_H
6#define BITCOIN_BLOCKINDEX_H
199 i++, pindex = pindex->
pprev) {
221 return nStatus.isAssumedValid();
@ TRANSACTIONS
Only first tx is coinbase, 2 <= coinbase input script length <= 100, transactions valid,...
@ SCRIPTS
Scripts & signatures ok.
The block chain is a tree shaped structure starting with the genesis block at the root,...
bool IsValid(enum BlockValidity nUpTo=BlockValidity::TRANSACTIONS) const EXCLUSIVE_LOCKS_REQUIRED(
Check whether this block index entry is valid up to the passed validity level.
std::string ToString() const
CBlockIndex * pprev
pointer to the index of the predecessor of this block
bool IsAssumedValid() const EXCLUSIVE_LOCKS_REQUIRED(
void BuildSkip()
Build the skiplist pointer for this entry.
int64_t GetHeaderReceivedTime() const
CBlockHeader GetBlockHeader() const
uint64_t nChainSize
(memory only) Size of all blocks in the chain up to and including this block.
arith_uint256 nChainWork
(memory only) Total amount of work (expected number of hashes) in the chain up to and including this ...
const BlockHash * phashBlock
pointer to the hash of the block, if any.
bool HaveTxsDownloaded() const
Check whether this block's and all previous blocks' transactions have been downloaded (and stored to ...
unsigned int nDataPos GUARDED_BY(::cs_main)
Byte offset within blk?????.dat where this block's data is stored.
unsigned int nUndoPos GUARDED_BY(::cs_main)
Byte offset within rev?????.dat where this block's undo data is stored.
BlockStatus nStatus GUARDED_BY(::cs_main)
Verification status of this block. See enum BlockStatus.
int64_t GetChainTxCount() const
Get the number of transaction in the chain so far.
unsigned int nTimeMax
(memory only) Maximum nTime in the chain up to and including this block.
int32_t nSequenceId
(memory only) Sequential id assigned to distinguish order in which blocks are received.
uint64_t GetChainSize() const
Get the size of all the blocks in the chain so far.
int64_t GetReceivedTimeDiff() const
int64_t GetBlockTime() const
int64_t GetMedianTimePast() const
FlatFilePos GetUndoPos() const EXCLUSIVE_LOCKS_REQUIRED(
bool UpdateChainStats()
Update chain tx stats.
CBlockIndex * pskip
pointer to the index of some further predecessor of this block
int64_t GetBlockTimeMax() const
unsigned int nTx
Number of transactions in this block.
CBlockIndex(const CBlockHeader &block)
bool RaiseValidity(enum BlockValidity nUpTo) EXCLUSIVE_LOCKS_REQUIRED(
Raise the validity level of this block index entry.
int32_t nVersion
block header
int64_t nTimeReceived
(memory only) block header metadata
CBlockIndex * GetAncestor(int height)
Efficiently find an ancestor of this block.
BlockHash GetBlockHash() const
unsigned int nSize
Size of this block.
int nHeight
height of the entry in the chain. The genesis block has height 0
FlatFilePos GetBlockPos() const EXCLUSIVE_LOCKS_REQUIRED(
unsigned int nChainTx
(memory only) Number of transactions in the chain up to and including this block.
int nFile GUARDED_BY(::cs_main)
Which # file this block is stored in (blk?????.dat)
static constexpr int nMedianTimeSpan
256-bit unsigned big integer.
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
A BlockHash is a unqiue identifier for a block.
#define AssertLockHeld(cs)
#define EXCLUSIVE_LOCKS_REQUIRED(...)
std::chrono::time_point< NodeClock, std::chrono::seconds > NodeSeconds