Bitcoin Core  27.99.0
P2P Digital Currency
Functions
chain.cpp File Reference
#include <chain.h>
#include <tinyformat.h>
#include <util/time.h>
Include dependency graph for chain.cpp:

Go to the source code of this file.

Functions

std::vector< uint256LocatorEntries (const CBlockIndex *index)
 Construct a list of hash entries to put in a locator. More...
 
CBlockLocator GetLocator (const CBlockIndex *index)
 Get a locator for a block index entry. More...
 
static int InvertLowestOne (int n)
 Turn the lowest '1' bit in the binary representation of a number into a '0'. More...
 
static int GetSkipHeight (int height)
 Compute what height to jump back to with the CBlockIndex::pskip pointer. More...
 
arith_uint256 GetBlockProof (const CBlockIndex &block)
 
int64_t GetBlockProofEquivalentTime (const CBlockIndex &to, const CBlockIndex &from, const CBlockIndex &tip, const Consensus::Params &params)
 Return the time it would take to redo the work difference between from and to, assuming the current hashrate corresponds to the difficulty at tip, in seconds. More...
 
const CBlockIndexLastCommonAncestor (const CBlockIndex *pa, const CBlockIndex *pb)
 Find the last common ancestor two blocks have. More...
 

Function Documentation

◆ GetBlockProof()

arith_uint256 GetBlockProof ( const CBlockIndex block)

Definition at line 131 of file chain.cpp.

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

◆ GetBlockProofEquivalentTime()

int64_t GetBlockProofEquivalentTime ( const CBlockIndex to,
const CBlockIndex from,
const CBlockIndex tip,
const Consensus::Params params 
)

Return the time it would take to redo the work difference between from and to, assuming the current hashrate corresponds to the difficulty at tip, in seconds.

Definition at line 146 of file chain.cpp.

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

◆ GetLocator()

CBlockLocator GetLocator ( const CBlockIndex index)

Get a locator for a block index entry.

Definition at line 50 of file chain.cpp.

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

◆ GetSkipHeight()

static int GetSkipHeight ( int  height)
inlinestatic

Compute what height to jump back to with the CBlockIndex::pskip pointer.

Definition at line 83 of file chain.cpp.

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

◆ InvertLowestOne()

static int InvertLowestOne ( int  n)
inlinestatic

Turn the lowest '1' bit in the binary representation of a number into a '0'.

Definition at line 80 of file chain.cpp.

Here is the caller graph for this function:

◆ LastCommonAncestor()

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

Find the last common ancestor two blocks have.

Find the forking point between two chain tips.

Both pa and pb must be non-nullptr.

Definition at line 165 of file chain.cpp.

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

◆ LocatorEntries()

std::vector<uint256> LocatorEntries ( const CBlockIndex index)

Construct a list of hash entries to put in a locator.


Definition at line 31 of file chain.cpp.

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