![]() |
Bitcoin Core 22.99.0
P2P Digital Currency
|
#include <rpc/blockchain.h>
#include <blockfilter.h>
#include <chain.h>
#include <chainparams.h>
#include <coins.h>
#include <consensus/amount.h>
#include <consensus/params.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <deploymentinfo.h>
#include <deploymentstatus.h>
#include <hash.h>
#include <index/blockfilterindex.h>
#include <index/coinstatsindex.h>
#include <node/blockstorage.h>
#include <node/coinstats.h>
#include <node/context.h>
#include <node/utxo_snapshot.h>
#include <policy/feerate.h>
#include <policy/fees.h>
#include <policy/policy.h>
#include <policy/rbf.h>
#include <primitives/transaction.h>
#include <rpc/server.h>
#include <rpc/util.h>
#include <script/descriptor.h>
#include <streams.h>
#include <sync.h>
#include <txdb.h>
#include <txmempool.h>
#include <undo.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/system.h>
#include <util/translation.h>
#include <validation.h>
#include <validationinterface.h>
#include <versionbits.h>
#include <warnings.h>
#include <stdint.h>
#include <univalue.h>
#include <condition_variable>
#include <memory>
#include <mutex>
Go to the source code of this file.
Classes | |
struct | CUpdatedBlock |
struct | CompareBlocksByHeight |
Comparison function for sorting the getchaintips heads. More... | |
class | CoinsViewScanReserver |
Functions | |
static CUpdatedBlock latestblock | GUARDED_BY (cs_blockchange) |
NodeContext & | EnsureAnyNodeContext (const std::any &context) |
CTxMemPool & | EnsureMemPool (const NodeContext &node) |
CTxMemPool & | EnsureAnyMemPool (const std::any &context) |
ChainstateManager & | EnsureChainman (const NodeContext &node) |
ChainstateManager & | EnsureAnyChainman (const std::any &context) |
CBlockPolicyEstimator & | EnsureFeeEstimator (const NodeContext &node) |
CBlockPolicyEstimator & | EnsureAnyFeeEstimator (const std::any &context) |
double | GetDifficulty (const CBlockIndex *blockindex) |
Get the difficulty of the net wrt to the given block index. More... | |
static int | ComputeNextBlockAndDepth (const CBlockIndex *tip, const CBlockIndex *blockindex, const CBlockIndex *&next) |
CBlockIndex * | ParseHashOrHeight (const UniValue ¶m, ChainstateManager &chainman) |
UniValue | blockheaderToJSON (const CBlockIndex *tip, const CBlockIndex *blockindex) |
Block header to JSON. More... | |
UniValue | blockToJSON (const CBlock &block, const CBlockIndex *tip, const CBlockIndex *blockindex, TxVerbosity verbosity) |
Block description to JSON. More... | |
static RPCHelpMan | getblockcount () |
static RPCHelpMan | getbestblockhash () |
void | RPCNotifyBlockChange (const CBlockIndex *pindex) |
Callback for when block tip changed. More... | |
static RPCHelpMan | waitfornewblock () |
static RPCHelpMan | waitforblock () |
static RPCHelpMan | waitforblockheight () |
static RPCHelpMan | syncwithvalidationinterfacequeue () |
static RPCHelpMan | getdifficulty () |
static std::vector< RPCResult > | MempoolEntryDescription () |
static void | entryToJSON (const CTxMemPool &pool, UniValue &info, const CTxMemPoolEntry &e) EXCLUSIVE_LOCKS_REQUIRED(pool.cs) |
UniValue | MempoolToJSON (const CTxMemPool &pool, bool verbose, bool include_mempool_sequence) |
Mempool to JSON. More... | |
static RPCHelpMan | getrawmempool () |
static RPCHelpMan | getmempoolancestors () |
static RPCHelpMan | getmempooldescendants () |
static RPCHelpMan | getmempoolentry () |
static RPCHelpMan | getblockhash () |
static RPCHelpMan | getblockheader () |
static CBlock | GetBlockChecked (const CBlockIndex *pblockindex) |
static CBlockUndo | GetUndoChecked (const CBlockIndex *pblockindex) |
static RPCHelpMan | getblock () |
static RPCHelpMan | pruneblockchain () |
CoinStatsHashType | ParseHashType (const std::string &hash_type_input) |
static RPCHelpMan | gettxoutsetinfo () |
static RPCHelpMan | gettxout () |
static RPCHelpMan | verifychain () |
static void | SoftForkDescPushBack (const CBlockIndex *active_chain_tip, UniValue &softforks, const Consensus::Params ¶ms, Consensus::BuriedDeployment dep) |
static void | SoftForkDescPushBack (const CBlockIndex *active_chain_tip, UniValue &softforks, const Consensus::Params &consensusParams, Consensus::DeploymentPos id) |
RPCHelpMan | getblockchaininfo () |
static RPCHelpMan | getchaintips () |
UniValue | MempoolInfoToJSON (const CTxMemPool &pool) |
Mempool information to JSON. More... | |
static RPCHelpMan | getmempoolinfo () |
static RPCHelpMan | preciousblock () |
static RPCHelpMan | invalidateblock () |
static RPCHelpMan | reconsiderblock () |
static RPCHelpMan | getchaintxstats () |
template<typename T > | |
static T | CalculateTruncatedMedian (std::vector< T > &scores) |
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 More... | |
template<typename T > | |
static bool | SetHasKeys (const std::set< T > &set) |
template<typename T , typename Tk , typename... Args> | |
static bool | SetHasKeys (const std::set< T > &set, const Tk &key, const Args &... args) |
static RPCHelpMan | getblockstats () |
static RPCHelpMan | savemempool () |
static RPCHelpMan | scantxoutset () |
static RPCHelpMan | getblockfilter () |
static RPCHelpMan | dumptxoutset () |
Serialize the UTXO set to a file for loading elsewhere. More... | |
UniValue | CreateUTXOSnapshot (NodeContext &node, CChainState &chainstate, CAutoFile &afile) |
Helper to create UTXO snapshots given a chainstate and a file handle. More... | |
void | RegisterBlockchainRPCCommands (CRPCTable &t) |
Register block chain RPC commands. More... | |
Variables | |
static Mutex | cs_blockchange |
static std::condition_variable | cond_blockchange |
static constexpr size_t | PER_UTXO_OVERHEAD = sizeof(COutPoint) + sizeof(uint32_t) + sizeof(bool) |
static std::atomic< int > | g_scan_progress |
RAII object to prevent concurrency issue when scanning the txout set. More... | |
static std::atomic< bool > | g_scan_in_progress |
static std::atomic< bool > | g_should_abort_scan |
UniValue blockheaderToJSON | ( | const CBlockIndex * | tip, |
const CBlockIndex * | blockindex | ||
) |
Block header to JSON.
Definition at line 174 of file blockchain.cpp.
UniValue blockToJSON | ( | const CBlock & | block, |
const CBlockIndex * | tip, | ||
const CBlockIndex * | blockindex, | ||
TxVerbosity | verbosity | ||
) |
Block description to JSON.
Definition at line 203 of file blockchain.cpp.
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
Definition at line 1921 of file blockchain.cpp.
|
static |
Definition at line 137 of file blockchain.cpp.
UniValue CreateUTXOSnapshot | ( | NodeContext & | node, |
CChainState & | chainstate, | ||
CAutoFile & | afile | ||
) |
Helper to create UTXO snapshots given a chainstate and a file handle.
Definition at line 2581 of file blockchain.cpp.
|
static |
Serialize the UTXO set to a file for loading elsewhere.
Definition at line 2531 of file blockchain.cpp.
ChainstateManager & EnsureAnyChainman | ( | const std::any & | context | ) |
Definition at line 95 of file blockchain.cpp.
CBlockPolicyEstimator & EnsureAnyFeeEstimator | ( | const std::any & | context | ) |
Definition at line 108 of file blockchain.cpp.
CTxMemPool & EnsureAnyMemPool | ( | const std::any & | context | ) |
Definition at line 82 of file blockchain.cpp.
NodeContext & EnsureAnyNodeContext | ( | const std::any & | context | ) |
Definition at line 65 of file blockchain.cpp.
ChainstateManager & EnsureChainman | ( | const NodeContext & | node | ) |
Definition at line 87 of file blockchain.cpp.
CBlockPolicyEstimator & EnsureFeeEstimator | ( | const NodeContext & | node | ) |
Definition at line 100 of file blockchain.cpp.
CTxMemPool & EnsureMemPool | ( | const NodeContext & | node | ) |
Definition at line 74 of file blockchain.cpp.
|
static |
Definition at line 491 of file blockchain.cpp.
|
static |
Definition at line 260 of file blockchain.cpp.
|
static |
Definition at line 936 of file blockchain.cpp.
RPCHelpMan getblockchaininfo | ( | ) |
Definition at line 1433 of file blockchain.cpp.
|
static |
Definition at line 905 of file blockchain.cpp.
|
static |
Definition at line 239 of file blockchain.cpp.
|
static |
Definition at line 2447 of file blockchain.cpp.
|
static |
Definition at line 806 of file blockchain.cpp.
|
static |
Definition at line 835 of file blockchain.cpp.
|
static |
Definition at line 1961 of file blockchain.cpp.
|
static |
Definition at line 1559 of file blockchain.cpp.
|
static |
Definition at line 1825 of file blockchain.cpp.
|
static |
Definition at line 442 of file blockchain.cpp.
double GetDifficulty | ( | const CBlockIndex * | blockindex | ) |
Get the difficulty of the net wrt to the given block index.
Definition at line 115 of file blockchain.cpp.
|
static |
Definition at line 644 of file blockchain.cpp.
|
static |
Definition at line 708 of file blockchain.cpp.
|
static |
Definition at line 773 of file blockchain.cpp.
|
static |
Definition at line 1675 of file blockchain.cpp.
|
static |
Definition at line 594 of file blockchain.cpp.
|
static |
Definition at line 1258 of file blockchain.cpp.
|
static |
Definition at line 1116 of file blockchain.cpp.
|
static |
Definition at line 922 of file blockchain.cpp.
|
static |
|
static |
Definition at line 1744 of file blockchain.cpp.
|
static |
UniValue MempoolInfoToJSON | ( | const CTxMemPool & | pool | ) |
Mempool information to JSON.
Definition at line 1657 of file blockchain.cpp.
UniValue MempoolToJSON | ( | const CTxMemPool & | pool, |
bool | verbose, | ||
bool | include_mempool_sequence | ||
) |
Mempool to JSON.
Definition at line 553 of file blockchain.cpp.
CBlockIndex * ParseHashOrHeight | ( | const UniValue & | param, |
ChainstateManager & | chainman | ||
) |
Definition at line 147 of file blockchain.cpp.
CoinStatsHashType ParseHashType | ( | const std::string & | hash_type_input | ) |
Definition at line 1103 of file blockchain.cpp.
|
static |
Definition at line 1704 of file blockchain.cpp.
|
static |
Definition at line 1043 of file blockchain.cpp.
|
static |
Definition at line 1785 of file blockchain.cpp.
void RegisterBlockchainRPCCommands | ( | CRPCTable & | t | ) |
Register block chain RPC commands.
Definition at line 2642 of file blockchain.cpp.
void RPCNotifyBlockChange | ( | const CBlockIndex * | pindex | ) |
Callback for when block tip changed.
Definition at line 280 of file blockchain.cpp.
|
static |
Definition at line 2200 of file blockchain.cpp.
|
static |
Definition at line 2288 of file blockchain.cpp.
|
static |
|
static |
Definition at line 1370 of file blockchain.cpp.
|
static |
Definition at line 424 of file blockchain.cpp.
|
static |
Definition at line 1340 of file blockchain.cpp.
|
static |
Definition at line 332 of file blockchain.cpp.
|
static |
Definition at line 378 of file blockchain.cpp.
|
static |
Definition at line 290 of file blockchain.cpp.
|
static |
Definition at line 62 of file blockchain.cpp.
|
static |
Definition at line 61 of file blockchain.cpp.
|
static |
Definition at line 2261 of file blockchain.cpp.
|
static |
RAII object to prevent concurrency issue when scanning the txout set.
Definition at line 2260 of file blockchain.cpp.
|
static |
Definition at line 2262 of file blockchain.cpp.
|
staticconstexpr |
Definition at line 1959 of file blockchain.cpp.