Bitcoin
Functions | Variables
blockchain.h File Reference
#include <amount.h>
#include <sync.h>
#include <stdint.h>
#include <vector>

Go to the source code of this file.

Functions

double GetDifficulty (const CBlockIndex *blockindex)
 
void RPCNotifyBlockChange (bool ibd, const CBlockIndex *)
 
UniValue blockToJSON (const CBlock &block, const CBlockIndex *tip, const CBlockIndex *blockindex, bool txDetails=false) LOCKS_EXCLUDED(cs_main)
 
UniValue MempoolInfoToJSON (const CTxMemPool &pool)
 
UniValue MempoolToJSON (const CTxMemPool &pool, bool verbose=false)
 
UniValue blockheaderToJSON (const CBlockIndex *tip, const CBlockIndex *blockindex) LOCKS_EXCLUDED(cs_main)
 
void CalculatePercentilesByWeight (CAmount result[NUM_GETBLOCKSTATS_PERCENTILES], std::vector< std::pair< CAmount, int64_t >> &scores, int64_t total_weight)
 

Variables

RecursiveMutex cs_main
 
static constexpr int NUM_GETBLOCKSTATS_PERCENTILES = 5
 

Function Documentation

◆ blockheaderToJSON()

UniValue blockheaderToJSON ( const CBlockIndex tip,
const CBlockIndex blockindex 
)

Block header to JSON

◆ blockToJSON()

UniValue blockToJSON ( const CBlock block,
const CBlockIndex tip,
const CBlockIndex blockindex,
bool  txDetails = false 
)

Block description to JSON

◆ CalculatePercentilesByWeight()

void CalculatePercentilesByWeight ( CAmount  result[NUM_GETBLOCKSTATS_PERCENTILES],
std::vector< std::pair< CAmount, int64_t >> &  scores,
int64_t  total_weight 
)

Used by getblockstats to get feerates at different percentiles by weight

◆ GetDifficulty()

double GetDifficulty ( const CBlockIndex blockindex)

Get the difficulty of the net wrt to the given block index.

Returns
A floating point number that is a multiple of the main net minimum difficulty (4295032833 hashes).

◆ MempoolInfoToJSON()

UniValue MempoolInfoToJSON ( const CTxMemPool pool)

Mempool information to JSON

◆ MempoolToJSON()

UniValue MempoolToJSON ( const CTxMemPool pool,
bool  verbose = false 
)

Mempool to JSON

◆ RPCNotifyBlockChange()

void RPCNotifyBlockChange ( bool  ibd,
const CBlockIndex  
)

Callback for when block tip changed.

Variable Documentation

◆ cs_main

RecursiveMutex cs_main

Mutex to guard access to validation specific variables, such as reading or changing the chainstate.

This may also need to be locked when updating the transaction pool, e.g. on AcceptToMemoryPool. See CTxMemPool::cs comment for details.

The transaction pool has a separate lock to allow reading from it and the chainstate at the same time.

◆ NUM_GETBLOCKSTATS_PERCENTILES

constexpr int NUM_GETBLOCKSTATS_PERCENTILES = 5
static