Bitcoin
|
#include <chain.h>
Public Member Functions | |
CBlockIndex * | Genesis () const |
CBlockIndex * | Tip () const |
CBlockIndex * | operator[] (int nHeight) const |
bool | Contains (const CBlockIndex *pindex) const |
CBlockIndex * | Next (const CBlockIndex *pindex) const |
int | Height () const |
void | SetTip (CBlockIndex *pindex) |
CBlockLocator | GetLocator (const CBlockIndex *pindex=nullptr) const |
const CBlockIndex * | FindFork (const CBlockIndex *pindex) const |
CBlockIndex * | FindEarliestAtLeast (int64_t nTime, int height) const |
Private Attributes | |
std::vector< CBlockIndex * > | vChain |
Friends | |
bool | operator== (const CChain &a, const CChain &b) |
An in-memory indexed chain of blocks.
|
inline |
Efficiently check whether a block is present in this chain.
CBlockIndex * CChain::FindEarliestAtLeast | ( | int64_t | nTime, |
int | height | ||
) | const |
Find the earliest block with timestamp equal or greater than the given time and height equal or greater than the given height.
const CBlockIndex * CChain::FindFork | ( | const CBlockIndex * | pindex | ) | const |
Find the last common block between this chain and a block index entry.
|
inline |
Returns the index entry for the genesis block of this chain, or nullptr if none.
CBlockLocator CChain::GetLocator | ( | const CBlockIndex * | pindex = nullptr | ) | const |
Return a CBlockLocator that refers to a block in this chain (by default the tip).
|
inline |
Return the maximal height in the chain. Is equal to chain.Tip() ? chain.Tip()->nHeight : -1.
|
inline |
Find the successor of a block in this chain, or nullptr if the given index is not found or is the tip.
|
inline |
Returns the index entry at a particular height in this chain, or nullptr if no such height exists.
void CChain::SetTip | ( | CBlockIndex * | pindex | ) |
Set/initialize a chain with a given tip.
CChain implementation
|
inline |
Returns the index entry for the tip of this chain, or nullptr if none.
|
private |