![]() |
Bitcoin Core 30.99.0
P2P Digital Currency
|
#include <rpc/blockchain.h>#include <blockfilter.h>#include <chain.h>#include <chainparams.h>#include <chainparamsbase.h>#include <clientversion.h>#include <coins.h>#include <common/args.h>#include <consensus/amount.h>#include <consensus/params.h>#include <consensus/validation.h>#include <core_io.h>#include <deploymentinfo.h>#include <deploymentstatus.h>#include <flatfile.h>#include <hash.h>#include <index/blockfilterindex.h>#include <index/coinstatsindex.h>#include <interfaces/mining.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/transaction.h>#include <node/utxo_snapshot.h>#include <node/warnings.h>#include <primitives/transaction.h>#include <rpc/server.h>#include <rpc/server_util.h>#include <rpc/util.h>#include <script/descriptor.h>#include <serialize.h>#include <streams.h>#include <sync.h>#include <tinyformat.h>#include <txdb.h>#include <txmempool.h>#include <undo.h>#include <univalue.h>#include <util/check.h>#include <util/fs.h>#include <util/strencodings.h>#include <util/syserror.h>#include <util/translation.h>#include <validation.h>#include <validationinterface.h>#include <versionbits.h>#include <cstdint>#include <condition_variable>#include <iterator>#include <memory>#include <mutex>#include <optional>#include <string>#include <string_view>#include <vector>Go to the source code of this file.
Classes | |
| struct | CompareBlocksByHeight |
| Comparison function for sorting the getchaintips heads. More... | |
| class | CoinsViewScanReserver |
| class | BlockFiltersScanReserver |
| class | NetworkDisable |
| RAII class that disables the network in its constructor and enables it in its destructor. More... | |
| class | TemporaryRollback |
| RAII class that temporarily rolls back the local chain in it's constructor and rolls it forward again in it's destructor. More... | |
Functions | |
| std::tuple< std::unique_ptr< CCoinsViewCursor >, CCoinsStats, const CBlockIndex * > PrepareUTXOSnapshot(Chainstate &chainstate, const std::function< void()> &interruption_point={}) EXCLUSIVE_LOCKS_REQUIRED(UniValue | WriteUTXOSnapshot (Chainstate &chainstate, CCoinsViewCursor *pcursor, CCoinsStats *maybe_stats, const CBlockIndex *tip, AutoFile &&afile, const fs::path &path, const fs::path &temppath, const std::function< void()> &interruption_point={}) |
| 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, const uint256 pow_limit) |
| Block header to JSON. More... | |
| UniValue | blockToJSON (BlockManager &blockman, const CBlock &block, const CBlockIndex &tip, const CBlockIndex &blockindex, TxVerbosity verbosity, const uint256 pow_limit) |
| Block description to JSON. More... | |
| static RPCHelpMan | getblockcount () |
| static RPCHelpMan | getbestblockhash () |
| static RPCHelpMan | waitfornewblock () |
| static RPCHelpMan | waitforblock () |
| static RPCHelpMan | waitforblockheight () |
| static RPCHelpMan | syncwithvalidationinterfacequeue () |
| static RPCHelpMan | getdifficulty () |
| static RPCHelpMan | getblockfrompeer () |
| static RPCHelpMan | getblockhash () |
| static RPCHelpMan | getblockheader () |
| void | CheckBlockDataAvailability (BlockManager &blockman, const CBlockIndex &blockindex, bool check_for_undo) |
| static CBlock | GetBlockChecked (BlockManager &blockman, const CBlockIndex &blockindex) |
| static std::vector< std::byte > | GetRawBlockChecked (BlockManager &blockman, const CBlockIndex &blockindex) |
| static CBlockUndo | GetUndoChecked (BlockManager &blockman, const CBlockIndex &blockindex) |
| static RPCHelpMan | getblock () |
| std::optional< int > | GetPruneHeight (const BlockManager &blockman, const CChain &chain) |
| Return height of highest block that has been pruned, or std::nullopt if no blocks have been pruned. More... | |
| static RPCHelpMan | pruneblockchain () |
| CoinStatsHashType | ParseHashType (std::string_view 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 () |
| RPCHelpMan | getdeploymentinfo () |
| static RPCHelpMan | getchaintips () |
| static RPCHelpMan | preciousblock () |
| void | InvalidateBlock (ChainstateManager &chainman, const uint256 block_hash) |
| static RPCHelpMan | invalidateblock () |
| void | ReconsiderBlock (ChainstateManager &chainman, uint256 block_hash) |
| 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 bool | CheckBlockFilterMatches (BlockManager &blockman, const CBlockIndex &blockindex, const GCSFilter::ElementSet &needles) |
| static RPCHelpMan | scanblocks () |
| static RPCHelpMan | getdescriptoractivity () |
| static RPCHelpMan | getblockfilter () |
| static RPCHelpMan | dumptxoutset () |
| Serialize the UTXO set to a file for loading elsewhere. More... | |
| std::tuple< std::unique_ptr< CCoinsViewCursor >, CCoinsStats, const CBlockIndex * > | PrepareUTXOSnapshot (Chainstate &chainstate, const std::function< void()> &interruption_point) |
| UniValue | CreateUTXOSnapshot (node::NodeContext &node, Chainstate &chainstate, AutoFile &&afile, const fs::path &path, const fs::path &tmppath) |
| Test-only helper to create UTXO snapshots given a chainstate and a file handle. More... | |
| static RPCHelpMan | loadtxoutset () |
| static RPCHelpMan | getchainstates () |
| void | RegisterBlockchainRPCCommands (CRPCTable &t) |
Variables | |
| 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 |
| static const auto | scan_action_arg_desc |
| static const auto | output_descriptor_obj |
| static const auto | scan_objects_arg_desc |
| static const auto | scan_result_abort |
| static const auto | scan_result_status_none |
| static const auto | scan_result_status_some |
| static std::atomic< int > | g_scanfilter_progress |
| RAII object to prevent concurrency issue when scanning blockfilters. More... | |
| static std::atomic< int > | g_scanfilter_progress_height |
| static std::atomic< bool > | g_scanfilter_in_progress |
| static std::atomic< bool > | g_scanfilter_should_abort_scan |
| const std::vector< RPCResult > | RPCHelpForChainstate |
| UniValue blockheaderToJSON | ( | const CBlockIndex & | tip, |
| const CBlockIndex & | blockindex, | ||
| const uint256 | pow_limit | ||
| ) |
Block header to JSON.
Definition at line 154 of file blockchain.cpp.
| UniValue blockToJSON | ( | BlockManager & | blockman, |
| const CBlock & | block, | ||
| const CBlockIndex & | tip, | ||
| const CBlockIndex & | blockindex, | ||
| TxVerbosity | verbosity, | ||
| const uint256 | pow_limit | ||
| ) |
Block description to JSON.
Definition at line 184 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 1869 of file blockchain.cpp.
|
static |
| void CheckBlockDataAvailability | ( | BlockManager & | blockman, |
| const CBlockIndex & | blockindex, | ||
| bool | check_for_undo | ||
| ) |
Definition at line 649 of file blockchain.cpp.
|
static |
Definition at line 2459 of file blockchain.cpp.
|
static |
Definition at line 116 of file blockchain.cpp.
| UniValue CreateUTXOSnapshot | ( | node::NodeContext & | node, |
| Chainstate & | chainstate, | ||
| AutoFile && | afile, | ||
| const fs::path & | path, | ||
| const fs::path & | tmppath | ||
| ) |
Test-only helper to create UTXO snapshots given a chainstate and a file handle.
Definition at line 3300 of file blockchain.cpp.
|
static |
Serialize the UTXO set to a file for loading elsewhere.
Definition at line 3027 of file blockchain.cpp.
|
static |
Definition at line 247 of file blockchain.cpp.
|
static |
Definition at line 743 of file blockchain.cpp.
| RPCHelpMan getblockchaininfo | ( | ) |
Definition at line 1339 of file blockchain.cpp.
|
static |
Definition at line 664 of file blockchain.cpp.
|
static |
Definition at line 225 of file blockchain.cpp.
|
static |
Definition at line 2909 of file blockchain.cpp.
|
static |
Definition at line 492 of file blockchain.cpp.
|
static |
Definition at line 547 of file blockchain.cpp.
|
static |
Definition at line 577 of file blockchain.cpp.
|
static |
Definition at line 1909 of file blockchain.cpp.
|
static |
Definition at line 3412 of file blockchain.cpp.
|
static |
Definition at line 1531 of file blockchain.cpp.
|
static |
Definition at line 1762 of file blockchain.cpp.
| RPCHelpMan getdeploymentinfo | ( | ) |
Definition at line 1464 of file blockchain.cpp.
|
static |
Definition at line 2673 of file blockchain.cpp.
|
static |
Definition at line 471 of file blockchain.cpp.
| double GetDifficulty | ( | const CBlockIndex & | blockindex | ) |
Get the difficulty of the net wrt to the given block index.
Definition at line 96 of file blockchain.cpp.
| std::optional< int > GetPruneHeight | ( | const BlockManager & | blockman, |
| const CChain & | chain | ||
| ) |
Return height of highest block that has been pruned, or std::nullopt if no blocks have been pruned.
Definition at line 858 of file blockchain.cpp.
|
static |
Definition at line 681 of file blockchain.cpp.
|
static |
Definition at line 1157 of file blockchain.cpp.
|
static |
Definition at line 985 of file blockchain.cpp.
|
static |
Definition at line 700 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 960 of file blockchain.cpp.
|
static |
Definition at line 1691 of file blockchain.cpp.
| void InvalidateBlock | ( | ChainstateManager & | chainman, |
| const uint256 | block_hash | ||
| ) |
Definition at line 1670 of file blockchain.cpp.
|
static |
Definition at line 3318 of file blockchain.cpp.
|
static |
Definition at line 126 of file blockchain.cpp.
| CoinStatsHashType ParseHashType | ( | std::string_view | hash_type_input | ) |
Definition at line 942 of file blockchain.cpp.
|
static |
Definition at line 1629 of file blockchain.cpp.
| std::tuple< std::unique_ptr< CCoinsViewCursor >, CCoinsStats, const CBlockIndex * > PrepareUTXOSnapshot | ( | Chainstate & | chainstate, |
| const std::function< void()> & | interruption_point | ||
| ) |
Definition at line 3184 of file blockchain.cpp.
|
static |
Definition at line 883 of file blockchain.cpp.
|
static |
Definition at line 1736 of file blockchain.cpp.
| void ReconsiderBlock | ( | ChainstateManager & | chainman, |
| uint256 | block_hash | ||
| ) |
Definition at line 1716 of file blockchain.cpp.
| void RegisterBlockchainRPCCommands | ( | CRPCTable & | t | ) |
Definition at line 3473 of file blockchain.cpp.
|
static |
Definition at line 2484 of file blockchain.cpp.
|
static |
Definition at line 2269 of file blockchain.cpp.
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
|
static |
Definition at line 451 of file blockchain.cpp.
|
static |
Definition at line 1237 of file blockchain.cpp.
|
static |
Definition at line 327 of file blockchain.cpp.
|
static |
Definition at line 388 of file blockchain.cpp.
|
static |
Definition at line 268 of file blockchain.cpp.
| UniValue WriteUTXOSnapshot | ( | Chainstate & | chainstate, |
| CCoinsViewCursor * | pcursor, | ||
| CCoinsStats * | maybe_stats, | ||
| const CBlockIndex * | tip, | ||
| AutoFile && | afile, | ||
| const fs::path & | path, | ||
| const fs::path & | temppath, | ||
| const std::function< void()> & | interruption_point = {} |
||
| ) |
Definition at line 3221 of file blockchain.cpp.
|
static |
Definition at line 2204 of file blockchain.cpp.
|
static |
RAII object to prevent concurrency issue when scanning the txout set.
Definition at line 2203 of file blockchain.cpp.
|
static |
Definition at line 2434 of file blockchain.cpp.
|
static |
RAII object to prevent concurrency issue when scanning blockfilters.
Definition at line 2432 of file blockchain.cpp.
|
static |
Definition at line 2433 of file blockchain.cpp.
|
static |
Definition at line 2435 of file blockchain.cpp.
|
static |
Definition at line 2205 of file blockchain.cpp.
| const RPCResult getblock_vin |
Definition at line 719 of file blockchain.cpp.
|
static |
Definition at line 2238 of file blockchain.cpp.
|
staticconstexpr |
Definition at line 1907 of file blockchain.cpp.
| const std::vector<RPCResult> RPCHelpForChainstate |
Definition at line 3399 of file blockchain.cpp.
|
static |
Definition at line 2231 of file blockchain.cpp.
|
static |
Definition at line 2246 of file blockchain.cpp.
|
static |
Definition at line 2256 of file blockchain.cpp.
|
static |
Definition at line 2260 of file blockchain.cpp.
|
static |
Definition at line 2263 of file blockchain.cpp.