![]() |
Bitcoin ABC 0.32.4
P2P Digital Currency
|
#include <rpc/blockchain.h>#include <avalanche/processor.h>#include <blockfilter.h>#include <chain.h>#include <chainparams.h>#include <clientversion.h>#include <coins.h>#include <common/args.h>#include <config.h>#include <consensus/amount.h>#include <consensus/params.h>#include <consensus/validation.h>#include <core_io.h>#include <hash.h>#include <index/blockfilterindex.h>#include <index/coinstatsindex.h>#include <logging/timer.h>#include <net.h>#include <net_processing.h>#include <node/blockstorage.h>#include <node/coinstats.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 <serialize.h>#include <streams.h>#include <txdb.h>#include <txmempool.h>#include <undo.h>#include <util/check.h>#include <util/fs.h>#include <util/strencodings.h>#include <util/string.h>#include <util/translation.h>#include <validation.h>#include <validationinterface.h>#include <warnings.h>#include <condition_variable>#include <cstdint>#include <memory>#include <mutex>#include <optional>Go to the source code of this file.
Classes | |
| struct | CUpdatedBlock |
| struct | CompareBlocksByHeight |
| Comparison function for sorting the getchaintips heads. More... | |
| class | CoinsViewScanReserver |
| 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 | |
| static CUpdatedBlock latestblock | GUARDED_BY (cs_blockchange) |
| 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) |
| Calculate the difficulty for a 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, 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 RPCHelpMan | getblockfrompeer () |
| static RPCHelpMan | getblockhash () |
| static RPCHelpMan | getblockheader () |
| static CBlock | GetBlockChecked (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) |
| static RPCHelpMan | pruneblockchain () |
| static CoinStatsHashType | ParseHashType (const std::string &hash_type_input) |
| static RPCHelpMan | gettxoutsetinfo () |
| RPCHelpMan | gettxout () |
| static RPCHelpMan | verifychain () |
| RPCHelpMan | getblockchaininfo () |
| static RPCHelpMan | getchaintips () |
| static RPCHelpMan | preciousblock () |
| static void | InvalidateBlock (ChainstateManager &chainman, avalanche::Processor *const avalanche, const BlockHash &block_hash) |
| static RPCHelpMan | invalidateblock () |
| RPCHelpMan | parkblock () |
| static void | ReconsiderBlock (ChainstateManager &chainman, avalanche::Processor *const avalanche, const BlockHash &block_hash) |
| static RPCHelpMan | reconsiderblock () |
| RPCHelpMan | unparkblock () |
| static RPCHelpMan | getchaintxstats () |
| template<typename T > | |
| static T | CalculateTruncatedMedian (std::vector< T > &scores) |
| 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... | |
| 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 | |
| static GlobalMutex | cs_blockchange |
| static std::condition_variable | cond_blockchange |
| static constexpr size_t | PER_UTXO_OVERHEAD |
| 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 |
| const std::vector< RPCResult > | RPCHelpForChainstate |
| UniValue blockheaderToJSON | ( | const CBlockIndex & | tip, |
| const CBlockIndex & | blockindex | ||
| ) |
Block header to JSON.
Definition at line 146 of file blockchain.cpp.
| UniValue blockToJSON | ( | BlockManager & | blockman, |
| const CBlock & | block, | ||
| const CBlockIndex & | tip, | ||
| const CBlockIndex & | blockindex, | ||
| bool | txDetails | ||
| ) |
Block description to JSON.
Definition at line 180 of file blockchain.cpp.
|
static |
|
static |
Definition at line 103 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 3046 of file blockchain.cpp.
|
static |
Serialize the UTXO set to a file for loading elsewhere.
Definition at line 2707 of file blockchain.cpp.
|
static |
Definition at line 230 of file blockchain.cpp.
|
static |
Definition at line 693 of file blockchain.cpp.
| RPCHelpMan getblockchaininfo | ( | ) |
Definition at line 1336 of file blockchain.cpp.
|
static |
Definition at line 652 of file blockchain.cpp.
|
static |
Definition at line 212 of file blockchain.cpp.
|
static |
Definition at line 2564 of file blockchain.cpp.
|
static |
Definition at line 473 of file blockchain.cpp.
|
static |
Definition at line 527 of file blockchain.cpp.
|
static |
Definition at line 556 of file blockchain.cpp.
|
static |
Definition at line 2008 of file blockchain.cpp.
|
static |
Definition at line 3177 of file blockchain.cpp.
|
static |
Idea: The set of chain tips is the active chain tip, plus orphan blocks which do not have another orphan building off of them. Algorithm:
Definition at line 1461 of file blockchain.cpp.
|
static |
Definition at line 1859 of file blockchain.cpp.
|
static |
Definition at line 453 of file blockchain.cpp.
| double GetDifficulty | ( | const CBlockIndex & | blockindex | ) |
Calculate the difficulty for a given block index.
Get the required difficulty of the next block w/r/t the given block index.
Definition at line 87 of file blockchain.cpp.
| std::optional< int > GetPruneHeight | ( | const BlockManager & | blockman, |
| const CChain & | chain | ||
| ) |
Definition at line 831 of file blockchain.cpp.
| RPCHelpMan gettxout | ( | ) |
Definition at line 1192 of file blockchain.cpp.
|
static |
Definition at line 957 of file blockchain.cpp.
|
static |
Definition at line 674 of file blockchain.cpp.
|
static |
|
static |
Definition at line 1657 of file blockchain.cpp.
|
static |
Definition at line 1633 of file blockchain.cpp.
|
static |
Definition at line 3056 of file blockchain.cpp.
| RPCHelpMan parkblock | ( | ) |
Definition at line 1684 of file blockchain.cpp.
|
static |
Definition at line 114 of file blockchain.cpp.
|
static |
Definition at line 943 of file blockchain.cpp.
|
static |
Definition at line 1586 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 2928 of file blockchain.cpp.
|
static |
Definition at line 869 of file blockchain.cpp.
|
static |
Definition at line 1763 of file blockchain.cpp.
|
static |
Definition at line 1739 of file blockchain.cpp.
| void RegisterBlockchainRPCCommands | ( | CRPCTable & | t | ) |
Definition at line 3251 of file blockchain.cpp.
| void RPCNotifyBlockChange | ( | const CBlockIndex * | pindex | ) |
Callback for when block tip changed.
Definition at line 248 of file blockchain.cpp.
|
static |
Definition at line 2337 of file blockchain.cpp.
|
inlinestatic |
|
inlinestatic |
|
static |
Definition at line 436 of file blockchain.cpp.
| RPCHelpMan unparkblock | ( | ) |
Definition at line 1792 of file blockchain.cpp.
|
static |
Definition at line 1296 of file blockchain.cpp.
|
static |
Definition at line 314 of file blockchain.cpp.
|
static |
Definition at line 376 of file blockchain.cpp.
|
static |
Definition at line 257 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 2968 of file blockchain.cpp.
|
static |
Definition at line 69 of file blockchain.cpp.
|
static |
Definition at line 68 of file blockchain.cpp.
|
static |
Definition at line 2312 of file blockchain.cpp.
|
static |
RAII object to prevent concurrency issue when scanning the txout set.
Definition at line 2311 of file blockchain.cpp.
|
static |
Definition at line 2313 of file blockchain.cpp.
|
staticconstexpr |
Definition at line 2005 of file blockchain.cpp.
| const std::vector<RPCResult> RPCHelpForChainstate |
Definition at line 3159 of file blockchain.cpp.