5#ifndef BITCOIN_BLOCKINDEX_H
6#define BITCOIN_BLOCKINDEX_H
100 if (nStatus.hasData()) {
110 if (nStatus.hasUndo()) {
198 i++, pindex = pindex->
pprev) {
202 std::sort(pbegin, pend);
203 return pbegin[(pend - pbegin) / 2];
213 return nStatus.isValid(nUpTo);
222 if (nStatus.isInvalid()) {
226 if (nStatus.getValidity() >= nUpTo) {
230 nStatus = nStatus.withValidity(nUpTo);
@ TRANSACTIONS
Only first tx is coinbase, 2 <= coinbase input script length <= 100, transactions valid,...
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.
void ResetChainStats()
Reset chain tx stats.
std::string ToString() const
CBlockIndex * pprev
pointer to the index of the predecessor of this block
void BuildSkip()
Build the skiplist pointer for this entry.
int64_t GetHeaderReceivedTime() const
void MaybeResetChainStats(bool is_snapshot_base_block)
Reset chain tx stats and log a warning if the block is not the snapshot block, and the nChainTx value...
CBlockHeader GetBlockHeader() const
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.
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.
bool HaveNumChainTxs() const
Check whether this block and all previous blocks back to the genesis block or an assumeutxo snapshot ...
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.
int64_t GetReceivedTimeDiff() const
int64_t GetBlockTime() const
int64_t GetMedianTimePast() const
FlatFilePos GetUndoPos() const EXCLUSIVE_LOCKS_REQUIRED(
bool UpdateChainStats()
Update chain tx stats and return True if this block is the genesis block or all parents have their tx...
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.
A BlockHash is a unqiue identifier for a block.
#define EXCLUSIVE_LOCKS_REQUIRED(...)
std::chrono::time_point< NodeClock, std::chrono::seconds > NodeSeconds