![]() |
Bitcoin Core
24.1.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 <fs.h>#include <hash.h>#include <index/blockfilterindex.h>#include <index/coinstatsindex.h>#include <kernel/coinstats.h>#include <logging/timer.h>#include <net.h>#include <net_processing.h>#include <node/blockstorage.h>#include <node/context.h>#include <node/utxo_snapshot.h>#include <primitives/transaction.h>#include <rpc/server.h>#include <rpc/server_util.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 <univalue.h>#include <util/check.h>#include <util/strencodings.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 <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) |
| 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) |
| static const CBlockIndex * | ParseHashOrHeight (const UniValue ¶m, ChainstateManager &chainman) |
| UniValue | blockheaderToJSON (const CBlockIndex *tip, const CBlockIndex *blockindex) |
| Block header to JSON. More... | |
| UniValue | blockToJSON (BlockManager &blockman, 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 RPCHelpMan | getblockfrompeer () |
| static RPCHelpMan | getblockhash () |
| static RPCHelpMan | getblockheader () |
| static CBlock | GetBlockChecked (BlockManager &blockman, const CBlockIndex *pblockindex) EXCLUSIVE_LOCKS_REQUIRED( |
| static CBlockUndo | GetUndoChecked (BlockManager &blockman, const CBlockIndex *pblockindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main) |
| static RPCHelpMan | getblock () |
| static RPCHelpMan | pruneblockchain () |
| CoinStatsHashType | ParseHashType (const std::string &hash_type_input) |
| static std::optional< kernel::CCoinsStats > | GetUTXOStats (CCoinsView *view, node::BlockManager &blockman, kernel::CoinStatsHashType hash_type, const std::function< void()> &interruption_point={}, const CBlockIndex *pindex=nullptr, bool index_requested=true) |
| Calculate statistics about the unspent transaction output set. More... | |
| static RPCHelpMan | gettxoutsetinfo () |
| static RPCHelpMan | gettxout () |
| static RPCHelpMan | verifychain () |
| static void | SoftForkDescPushBack (const CBlockIndex *blockindex, UniValue &softforks, const ChainstateManager &chainman, Consensus::BuriedDeployment dep) |
| static void | SoftForkDescPushBack (const CBlockIndex *blockindex, UniValue &softforks, const ChainstateManager &chainman, Consensus::DeploymentPos id) |
| RPCHelpMan | getblockchaininfo () |
| static RPCHelpMan | getdeploymentinfo () |
| static RPCHelpMan | getchaintips () |
| 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 | scantxoutset () |
| static RPCHelpMan | getblockfilter () |
| static RPCHelpMan | dumptxoutset () |
| Serialize the UTXO set to a file for loading elsewhere. More... | |
| UniValue | CreateUTXOSnapshot (NodeContext &node, Chainstate &chainstate, AutoFile &afile, const fs::path &path, const fs::path &temppath) |
| Helper to create UTXO snapshots given a chainstate and a file handle. More... | |
| void | RegisterBlockchainRPCCommands (CRPCTable &t) |
Variables | |
| static GlobalMutex | cs_blockchange |
| static std::condition_variable | cond_blockchange |
| const RPCResult | getblock_vin |
| 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 136 of file blockchain.cpp.
| UniValue blockToJSON | ( | BlockManager & | blockman, |
| const CBlock & | block, | ||
| const CBlockIndex * | tip, | ||
| const CBlockIndex * | blockindex, | ||
| TxVerbosity | verbosity | ||
| ) |
Block description to JSON.
Definition at line 165 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 1683 of file blockchain.cpp.
|
static |
|
static |
Definition at line 98 of file blockchain.cpp.
| UniValue CreateUTXOSnapshot | ( | node::NodeContext & | node, |
| Chainstate & | chainstate, | ||
| AutoFile & | afile, | ||
| const fs::path & | path, | ||
| const fs::path & | tmppath | ||
| ) |
Helper to create UTXO snapshots given a chainstate and a file handle.
Definition at line 2329 of file blockchain.cpp.
|
static |
Serialize the UTXO set to a file for loading elsewhere.
Definition at line 2273 of file blockchain.cpp.
|
static |
Definition at line 223 of file blockchain.cpp.
|
static |
Definition at line 631 of file blockchain.cpp.
| RPCHelpMan getblockchaininfo | ( | ) |
Definition at line 1202 of file blockchain.cpp.
|
static |
Definition at line 574 of file blockchain.cpp.
|
static |
Definition at line 202 of file blockchain.cpp.
|
static |
Definition at line 2189 of file blockchain.cpp.
|
static |
Definition at line 425 of file blockchain.cpp.
|
static |
Definition at line 475 of file blockchain.cpp.
|
static |
Definition at line 504 of file blockchain.cpp.
|
static |
Definition at line 1723 of file blockchain.cpp.
|
static |
Definition at line 1368 of file blockchain.cpp.
|
static |
Definition at line 1587 of file blockchain.cpp.
|
static |
Definition at line 1310 of file blockchain.cpp.
| double GetDifficulty | ( | const CBlockIndex * | blockindex | ) |
Get the difficulty of the net wrt to the given block index.
Definition at line 76 of file blockchain.cpp.
|
static |
Definition at line 405 of file blockchain.cpp.
|
static |
Definition at line 1003 of file blockchain.cpp.
|
static |
Definition at line 852 of file blockchain.cpp.
|
static |
Definition at line 592 of file blockchain.cpp.
|
static |
Calculate statistics about the unspent transaction output set.
| [in] | index_requested | Signals if the coinstatsindex should be used (when available). |
Definition at line 827 of file blockchain.cpp.
|
static |
|
static |
Definition at line 1506 of file blockchain.cpp.
|
static |
Definition at line 108 of file blockchain.cpp.
| CoinStatsHashType ParseHashType | ( | const std::string & | hash_type_input | ) |
Definition at line 809 of file blockchain.cpp.
|
static |
Definition at line 1466 of file blockchain.cpp.
|
static |
Definition at line 750 of file blockchain.cpp.
|
static |
Definition at line 1547 of file blockchain.cpp.
| void RegisterBlockchainRPCCommands | ( | CRPCTable & | t | ) |
Definition at line 2403 of file blockchain.cpp.
| void RPCNotifyBlockChange | ( | const CBlockIndex * | ) |
Callback for when block tip changed.
Definition at line 243 of file blockchain.cpp.
|
static |
Definition at line 2022 of file blockchain.cpp.
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
|
static |
Definition at line 387 of file blockchain.cpp.
|
static |
Definition at line 1085 of file blockchain.cpp.
|
static |
Definition at line 295 of file blockchain.cpp.
|
static |
Definition at line 341 of file blockchain.cpp.
|
static |
Definition at line 253 of file blockchain.cpp.
|
static |
Definition at line 71 of file blockchain.cpp.
|
static |
Definition at line 70 of file blockchain.cpp.
|
static |
Definition at line 1995 of file blockchain.cpp.
|
static |
RAII object to prevent concurrency issue when scanning the txout set.
Definition at line 1994 of file blockchain.cpp.
|
static |
Definition at line 1996 of file blockchain.cpp.
| const RPCResult getblock_vin |
Definition at line 607 of file blockchain.cpp.
|
static |
Definition at line 1721 of file blockchain.cpp.
1.8.14