![]() |
Bitcoin Core
22.0.0
P2P Digital Currency
|
#include <rpc/blockchain.h>#include <amount.h>#include <blockfilter.h>#include <chain.h>#include <chainparams.h>#include <coins.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/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, bool txDetails) |
| 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... | |
| void | ScriptPubKeyToUniv (const CScript &scriptPubKey, UniValue &out, bool fIncludeHex) |
| void | TxToUniv (const CTransaction &tx, const uint256 &hashBlock, UniValue &entry, bool include_hex, int serialize_flags, const CTxUndo *txundo) |
| 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 173 of file blockchain.cpp.
| UniValue blockToJSON | ( | const CBlock & | block, |
| const CBlockIndex * | tip, | ||
| const CBlockIndex * | blockindex, | ||
| bool | txDetails | ||
| ) |
Block description to JSON.
Definition at line 202 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 1898 of file blockchain.cpp.
|
static |
|
static |
Definition at line 136 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 2568 of file blockchain.cpp.
|
static |
Serialize the UTXO set to a file for loading elsewhere.
Definition at line 2518 of file blockchain.cpp.
| ChainstateManager& EnsureAnyChainman | ( | const std::any & | context | ) |
Definition at line 94 of file blockchain.cpp.
| CBlockPolicyEstimator& EnsureAnyFeeEstimator | ( | const std::any & | context | ) |
Definition at line 107 of file blockchain.cpp.
| CTxMemPool& EnsureAnyMemPool | ( | const std::any & | context | ) |
Definition at line 81 of file blockchain.cpp.
| NodeContext& EnsureAnyNodeContext | ( | const std::any & | context | ) |
Definition at line 64 of file blockchain.cpp.
| ChainstateManager& EnsureChainman | ( | const NodeContext & | node | ) |
Definition at line 86 of file blockchain.cpp.
| CBlockPolicyEstimator& EnsureFeeEstimator | ( | const NodeContext & | node | ) |
Definition at line 99 of file blockchain.cpp.
| CTxMemPool& EnsureMemPool | ( | const NodeContext & | node | ) |
Definition at line 73 of file blockchain.cpp.
|
static |
Definition at line 483 of file blockchain.cpp.
|
static |
Definition at line 252 of file blockchain.cpp.
|
static |
Definition at line 928 of file blockchain.cpp.
| RPCHelpMan getblockchaininfo | ( | ) |
Definition at line 1412 of file blockchain.cpp.
|
static |
Definition at line 897 of file blockchain.cpp.
|
static |
Definition at line 231 of file blockchain.cpp.
|
static |
Definition at line 2434 of file blockchain.cpp.
|
static |
Definition at line 798 of file blockchain.cpp.
|
static |
Definition at line 827 of file blockchain.cpp.
|
static |
Definition at line 1948 of file blockchain.cpp.
|
static |
Definition at line 1536 of file blockchain.cpp.
|
static |
Definition at line 1802 of file blockchain.cpp.
| double GetDifficulty | ( | const CBlockIndex * | blockindex | ) |
Get the difficulty of the net wrt to the given block index.
Definition at line 114 of file blockchain.cpp.
|
static |
Definition at line 434 of file blockchain.cpp.
|
static |
Definition at line 636 of file blockchain.cpp.
|
static |
Definition at line 700 of file blockchain.cpp.
|
static |
Definition at line 765 of file blockchain.cpp.
|
static |
Definition at line 1652 of file blockchain.cpp.
|
static |
Definition at line 586 of file blockchain.cpp.
|
static |
Definition at line 1235 of file blockchain.cpp.
|
static |
Definition at line 1098 of file blockchain.cpp.
|
static |
Definition at line 914 of file blockchain.cpp.
|
static |
|
static |
Definition at line 1721 of file blockchain.cpp.
|
static |
| UniValue MempoolInfoToJSON | ( | const CTxMemPool & | pool | ) |
Mempool information to JSON.
Definition at line 1634 of file blockchain.cpp.
| UniValue MempoolToJSON | ( | const CTxMemPool & | pool, |
| bool | verbose, | ||
| bool | include_mempool_sequence | ||
| ) |
Mempool to JSON.
Definition at line 545 of file blockchain.cpp.
| CBlockIndex* ParseHashOrHeight | ( | const UniValue & | param, |
| ChainstateManager & | chainman | ||
| ) |
Definition at line 146 of file blockchain.cpp.
| CoinStatsHashType ParseHashType | ( | const std::string & | hash_type_input | ) |
Definition at line 1085 of file blockchain.cpp.
|
static |
Definition at line 1681 of file blockchain.cpp.
|
static |
Definition at line 1025 of file blockchain.cpp.
|
static |
Definition at line 1762 of file blockchain.cpp.
| void RegisterBlockchainRPCCommands | ( | CRPCTable & | t | ) |
Register block chain RPC commands.
Definition at line 2629 of file blockchain.cpp.
| void RPCNotifyBlockChange | ( | const CBlockIndex * | ) |
Callback for when block tip changed.
Definition at line 272 of file blockchain.cpp.
|
static |
Definition at line 2187 of file blockchain.cpp.
|
static |
Definition at line 2275 of file blockchain.cpp.
Definition at line 1927 of file blockchain.cpp.
|
inlinestatic |
|
inlinestatic |
|
static |
Definition at line 1350 of file blockchain.cpp.
|
static |
|
static |
Definition at line 416 of file blockchain.cpp.
| void TxToUniv | ( | const CTransaction & | tx, |
| const uint256 & | hashBlock, | ||
| UniValue & | entry, | ||
| bool | include_hex, | ||
| int | serialize_flags, | ||
| const CTxUndo * | txundo | ||
| ) |
Definition at line 1932 of file blockchain.cpp.
|
static |
Definition at line 1320 of file blockchain.cpp.
|
static |
Definition at line 324 of file blockchain.cpp.
|
static |
Definition at line 370 of file blockchain.cpp.
|
static |
Definition at line 282 of file blockchain.cpp.
|
static |
Definition at line 61 of file blockchain.cpp.
|
static |
Definition at line 60 of file blockchain.cpp.
|
static |
Definition at line 2248 of file blockchain.cpp.
|
static |
RAII object to prevent concurrency issue when scanning the txout set.
Definition at line 2247 of file blockchain.cpp.
|
static |
Definition at line 2249 of file blockchain.cpp.
|
static |
Definition at line 1946 of file blockchain.cpp.
1.8.14