Bitcoin Core 32.99.0
P2P Digital Currency
Classes | Functions | Variables
blockchain.cpp File Reference
#include <rpc/blockchain.h>
#include <rpc/register.h>
#include <arith_uint256.h>
#include <blockfilter.h>
#include <chain.h>
#include <chainparams.h>
#include <chainparamsbase.h>
#include <coins.h>
#include <common/args.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/params.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <crypto/hex_base.h>
#include <dbwrapper.h>
#include <deploymentinfo.h>
#include <flatfile.h>
#include <index/base.h>
#include <index/blockfilterindex.h>
#include <index/coinstatsindex.h>
#include <interfaces/types.h>
#include <kernel/coinstats.h>
#include <logging/timer.h>
#include <net.h>
#include <net_processing.h>
#include <node/block_template_manager.h>
#include <node/blockstorage.h>
#include <node/context.h>
#include <node/utxo_snapshot.h>
#include <node/warnings.h>
#include <policy/feerate.h>
#include <prevector.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <protocol.h>
#include <rpc/rawtransaction_util.h>
#include <rpc/request.h>
#include <rpc/server.h>
#include <rpc/server_util.h>
#include <rpc/util.h>
#include <script/descriptor.h>
#include <script/interpreter.h>
#include <script/script.h>
#include <script/signingprovider.h>
#include <serialize.h>
#include <span.h>
#include <streams.h>
#include <sync.h>
#include <tinyformat.h>
#include <txdb.h>
#include <txmempool.h>
#include <uint256.h>
#include <undo.h>
#include <univalue.h>
#include <util/chaintype.h>
#include <util/check.h>
#include <util/expected.h>
#include <util/fs.h>
#include <util/log.h>
#include <util/result.h>
#include <util/string.h>
#include <util/syserror.h>
#include <util/time.h>
#include <util/translation.h>
#include <validation.h>
#include <validationinterface.h>
#include <versionbits.h>
#include <algorithm>
#include <array>
#include <atomic>
#include <cerrno>
#include <compare>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <ios>
#include <map>
#include <memory>
#include <optional>
#include <ratio>
#include <set>
#include <span>
#include <stdexcept>
#include <string>
#include <string_view>
#include <tuple>
#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  TemporaryPruneLock
 RAII class that registers a prune lock in its constructor to prevent block data from being pruned, and removes it in its destructor. More...
 
class  TemporaryUTXODatabase
 RAII class that creates a temporary database directory in its constructor and removes it in its 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={})
 
UniValue CreateRolledBackUTXOSnapshot (NodeContext &node, Chainstate &chainstate, const CBlockIndex *target, AutoFile &&afile, const fs::path &path, const fs::path &tmppath, bool in_memory)
 
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 &param, ChainstateManager &chainman)
 
UniValue blockheaderToJSON (const CBlockIndex &tip, const CBlockIndex &blockindex, const uint256 pow_limit)
 Block header to JSON. More...
 
UniValue coinbaseTxToJSON (const CTransaction &coinbase_tx)
 Serialize coinbase transaction metadata. 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 RPCMethod getblockcount ()
 
static RPCMethod getbestblockhash ()
 
static RPCMethod waitfornewblock ()
 
static RPCMethod waitforblock ()
 
static RPCMethod waitforblockheight ()
 
static RPCMethod syncwithvalidationinterfacequeue ()
 
static RPCMethod getdifficulty ()
 
static RPCMethod getblockfrompeer ()
 
static RPCMethod getblockhash ()
 
static RPCMethod 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 std::vector< RPCResult > GetBlockFields (RPCResult tx_result, std::optional< std::string > elision_msg=std::nullopt)
 
static RPCMethod 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 RPCMethod pruneblockchain ()
 
CoinStatsHashType ParseHashType (std::string_view hash_type_input)
 
static std::optional< kernel::CCoinsStats > GetUTXOStats (const CCoinsViewDB &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 RPCMethod gettxoutsetinfo ()
 
static RPCMethod gettxout ()
 
static RPCMethod 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)
 
RPCMethod getblockchaininfo ()
 
RPCMethod getdeploymentinfo ()
 
static RPCMethod getchaintips ()
 
static RPCMethod preciousblock ()
 
void InvalidateBlock (ChainstateManager &chainman, const uint256 block_hash)
 
static RPCMethod invalidateblock ()
 
void ReconsiderBlock (ChainstateManager &chainman, uint256 block_hash)
 
static RPCMethod reconsiderblock ()
 
static RPCMethod 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 RPCMethod getblockstats ()
 
static RPCMethod scantxoutset ()
 
static bool CheckBlockFilterMatches (BlockManager &blockman, const CBlockIndex &blockindex, const GCSFilter::ElementSet &needles)
 
static RPCMethod scanblocks ()
 
static RPCMethod getdescriptoractivity ()
 
static RPCMethod getblockfilter ()
 
static RPCMethod 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)
 Helper to create UTXO snapshots given a chainstate and a file handle. More...
 
static RPCMethod loadtxoutset ()
 
static RPCMethod getchainstates ()
 
void RegisterBlockchainRPCCommands (CRPCTable &t)
 

Variables

static constexpr size_t PER_UTXO_OVERHEAD = sizeof(COutPoint) + sizeof(uint32_t)
 
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
 

Function Documentation

◆ blockheaderToJSON()

UniValue blockheaderToJSON ( const CBlockIndex &  tip,
const CBlockIndex &  blockindex,
const uint256  pow_limit 
)

Block header to JSON.

Definition at line 193 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ blockToJSON()

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 241 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CalculatePercentilesByWeight()

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 1954 of file blockchain.cpp.

Here is the caller graph for this function:

◆ CalculateTruncatedMedian()

template<typename T >
static T CalculateTruncatedMedian ( std::vector< T > &  scores)
static

Definition at line 1939 of file blockchain.cpp.

Here is the caller graph for this function:

◆ CheckBlockDataAvailability()

void CheckBlockDataAvailability ( BlockManager &  blockman,
const CBlockIndex &  blockindex,
bool  check_for_undo 
)

Definition at line 710 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckBlockFilterMatches()

static bool CheckBlockFilterMatches ( BlockManager &  blockman,
const CBlockIndex &  blockindex,
const GCSFilter::ElementSet &  needles 
)
static

Definition at line 2545 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ coinbaseTxToJSON()

UniValue coinbaseTxToJSON ( const CTransaction &  coinbase_tx)

Serialize coinbase transaction metadata.

Definition at line 224 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeNextBlockAndDepth()

static int ComputeNextBlockAndDepth ( const CBlockIndex &  tip,
const CBlockIndex &  blockindex,
const CBlockIndex *&  next 
)
static

Definition at line 155 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateRolledBackUTXOSnapshot()

UniValue CreateRolledBackUTXOSnapshot ( NodeContext &  node,
Chainstate &  chainstate,
const CBlockIndex *  target,
AutoFile &&  afile,
const fs::path &  path,
const fs::path &  tmppath,
bool  in_memory 
)

Definition at line 3242 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateUTXOSnapshot()

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.

Returns
a UniValue map containing metadata about the snapshot.

Definition at line 3497 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dumptxoutset()

static RPCMethod dumptxoutset ( )
static

Serialize the UTXO set to a file for loading elsewhere.

See also
SnapshotMetadata

Definition at line 3104 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getbestblockhash()

static RPCMethod getbestblockhash ( )
static

Definition at line 308 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getblock()

static RPCMethod getblock ( )
static

Definition at line 834 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getblockchaininfo()

RPCMethod getblockchaininfo ( )

Definition at line 1398 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBlockChecked()

static CBlock GetBlockChecked ( BlockManager &  blockman,
const CBlockIndex &  blockindex 
)
static

Definition at line 725 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getblockcount()

static RPCMethod getblockcount ( )
static

Definition at line 286 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBlockFields()

static std::vector< RPCResult > GetBlockFields ( RPCResult  tx_result,
std::optional< std::string >  elision_msg = std::nullopt 
)
static

Definition at line 776 of file blockchain.cpp.

Here is the caller graph for this function:

◆ getblockfilter()

static RPCMethod getblockfilter ( )
static

Definition at line 2999 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getblockfrompeer()

static RPCMethod getblockfrompeer ( )
static

Definition at line 553 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getblockhash()

static RPCMethod getblockhash ( )
static

Definition at line 608 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getblockheader()

static RPCMethod getblockheader ( )
static

Definition at line 638 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getblockstats()

static RPCMethod getblockstats ( )
static

Definition at line 1994 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getchainstates()

static RPCMethod getchainstates ( )
static

Definition at line 3609 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getchaintips()

static RPCMethod getchaintips ( )
static

Definition at line 1612 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getchaintxstats()

static RPCMethod getchaintxstats ( )
static

Definition at line 1847 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getdeploymentinfo()

RPCMethod getdeploymentinfo ( )

Definition at line 1544 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getdescriptoractivity()

static RPCMethod getdescriptoractivity ( )
static

Definition at line 2763 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getdifficulty()

static RPCMethod getdifficulty ( )
static

Definition at line 532 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDifficulty()

double GetDifficulty ( const CBlockIndex &  blockindex)

Get the difficulty of the net wrt to the given block index.

Returns
A floating point number that is a multiple of the main net minimum difficulty (4295032833 hashes).

Definition at line 135 of file blockchain.cpp.

Here is the caller graph for this function:

◆ GetPruneHeight()

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 922 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetRawBlockChecked()

static std::vector< std::byte > GetRawBlockChecked ( BlockManager &  blockman,
const CBlockIndex &  blockindex 
)
static

Definition at line 742 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gettxout()

static RPCMethod gettxout ( )
static

Definition at line 1216 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gettxoutsetinfo()

static RPCMethod gettxoutsetinfo ( )
static

Definition at line 1049 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetUndoChecked()

static CBlockUndo GetUndoChecked ( BlockManager &  blockman,
const CBlockIndex &  blockindex 
)
static

Definition at line 757 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetUTXOStats()

static std::optional< kernel::CCoinsStats > GetUTXOStats ( const CCoinsViewDB &  view,
node::BlockManager &  blockman,
kernel::CoinStatsHashType  hash_type,
const std::function< void()> &  interruption_point = {},
const CBlockIndex *  pindex = nullptr,
bool  index_requested = true 
)
static

Calculate statistics about the unspent transaction output set.

Parameters
[in]index_requestedSignals if the coinstatsindex should be used (when available).

Definition at line 1024 of file blockchain.cpp.

Here is the caller graph for this function:

◆ invalidateblock()

static RPCMethod invalidateblock ( )
static

Definition at line 1776 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InvalidateBlock()

void InvalidateBlock ( ChainstateManager &  chainman,
const uint256  block_hash 
)

Definition at line 1755 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadtxoutset()

static RPCMethod loadtxoutset ( )
static

Definition at line 3515 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseHashOrHeight()

static const CBlockIndex * ParseHashOrHeight ( const UniValue &  param,
ChainstateManager &  chainman 
)
static

Definition at line 165 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseHashType()

CoinStatsHashType ParseHashType ( std::string_view  hash_type_input)

Definition at line 1006 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ preciousblock()

static RPCMethod preciousblock ( )
static

Definition at line 1711 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrepareUTXOSnapshot()

std::tuple< std::unique_ptr< CCoinsViewCursor >, CCoinsStats, const CBlockIndex * > PrepareUTXOSnapshot ( Chainstate &  chainstate,
const std::function< void()> &  interruption_point 
)

Definition at line 3381 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pruneblockchain()

static RPCMethod pruneblockchain ( )
static

Definition at line 947 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reconsiderblock()

static RPCMethod reconsiderblock ( )
static

Definition at line 1821 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReconsiderBlock()

void ReconsiderBlock ( ChainstateManager &  chainman,
uint256  block_hash 
)

Definition at line 1801 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterBlockchainRPCCommands()

void RegisterBlockchainRPCCommands ( CRPCTable &  t)

Definition at line 3669 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scanblocks()

static RPCMethod scanblocks ( )
static

Definition at line 2570 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scantxoutset()

static RPCMethod scantxoutset ( )
static

Definition at line 2354 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetHasKeys() [1/2]

template<typename T >
static bool SetHasKeys ( const std::set< T > &  set)
inlinestatic

Definition at line 1984 of file blockchain.cpp.

Here is the caller graph for this function:

◆ SetHasKeys() [2/2]

template<typename T , typename Tk , typename... Args>
static bool SetHasKeys ( const std::set< T > &  set,
const Tk &  key,
const Args &...  args 
)
inlinestatic

Definition at line 1986 of file blockchain.cpp.

Here is the call graph for this function:

◆ SoftForkDescPushBack() [1/2]

static void SoftForkDescPushBack ( const CBlockIndex *  blockindex,
UniValue &  softforks,
const ChainstateManager &  chainman,
Consensus::BuriedDeployment  dep 
)
static

Definition at line 1327 of file blockchain.cpp.

Here is the call graph for this function:

◆ SoftForkDescPushBack() [2/2]

static void SoftForkDescPushBack ( const CBlockIndex *  blockindex,
UniValue &  softforks,
const ChainstateManager &  chainman,
Consensus::DeploymentPos  id 
)
static

Definition at line 1342 of file blockchain.cpp.

Here is the call graph for this function:

◆ syncwithvalidationinterfacequeue()

static RPCMethod syncwithvalidationinterfacequeue ( )
static

Definition at line 512 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifychain()

static RPCMethod verifychain ( )
static

Definition at line 1296 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ waitforblock()

static RPCMethod waitforblock ( )
static

Definition at line 388 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ waitforblockheight()

static RPCMethod waitforblockheight ( )
static

Definition at line 449 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ waitfornewblock()

static RPCMethod waitfornewblock ( )
static

Definition at line 329 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteUTXOSnapshot()

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 3418 of file blockchain.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_scan_in_progress

std::atomic<bool> g_scan_in_progress
static

Definition at line 2289 of file blockchain.cpp.

◆ g_scan_progress

std::atomic<int> g_scan_progress
static

RAII object to prevent concurrency issue when scanning the txout set.

Definition at line 2288 of file blockchain.cpp.

◆ g_scanfilter_in_progress

std::atomic<bool> g_scanfilter_in_progress
static

Definition at line 2520 of file blockchain.cpp.

◆ g_scanfilter_progress

std::atomic<int> g_scanfilter_progress
static

RAII object to prevent concurrency issue when scanning blockfilters.

Definition at line 2518 of file blockchain.cpp.

◆ g_scanfilter_progress_height

std::atomic<int> g_scanfilter_progress_height
static

Definition at line 2519 of file blockchain.cpp.

◆ g_scanfilter_should_abort_scan

std::atomic<bool> g_scanfilter_should_abort_scan
static

Definition at line 2521 of file blockchain.cpp.

◆ g_should_abort_scan

std::atomic<bool> g_should_abort_scan
static

Definition at line 2290 of file blockchain.cpp.

◆ output_descriptor_obj

const auto output_descriptor_obj
static
Initial value:
"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "An object with output descriptor and metadata",
{
{"desc", RPCArg::Type::STR, RPCArg::Optional::NO, "An output descriptor"},
{"range", RPCArg::Type::RANGE, RPCArg::Default{1000}, "The range of HD chain indexes to explore (either end or [begin,end])"},
}
}
Definition: util.h:186
@ RANGE
Special type that is a NUM or [NUM,NUM].
@ OMITTED
Optional argument for which the default value is omitted from help text for one of two reasons:
@ NO
Required arg.

Definition at line 2323 of file blockchain.cpp.

◆ PER_UTXO_OVERHEAD

constexpr size_t PER_UTXO_OVERHEAD = sizeof(COutPoint) + sizeof(uint32_t)
staticconstexpr

Definition at line 1992 of file blockchain.cpp.

◆ RPCHelpForChainstate

const std::vector<RPCResult> RPCHelpForChainstate
Initial value:
{
{RPCResult::Type::NUM, "blocks", "number of blocks in this chainstate"},
{RPCResult::Type::STR_HEX, "bestblockhash", "blockhash of the tip"},
{RPCResult::Type::STR_HEX, "bits", "nBits: compact representation of the block difficulty target"},
{RPCResult::Type::STR_HEX, "target", "The difficulty target"},
{RPCResult::Type::NUM, "difficulty", "difficulty of the tip"},
{RPCResult::Type::NUM, "verificationprogress", "progress towards the network tip"},
{RPCResult::Type::STR_HEX, "snapshot_blockhash", true, "the base block of the snapshot this chainstate is based on, if any"},
{RPCResult::Type::NUM, "coins_db_cache_bytes", "size of the coinsdb cache"},
{RPCResult::Type::NUM, "coins_tip_cache_bytes", "size of the coinstip cache"},
{RPCResult::Type::BOOL, "validated", "whether the chainstate is fully validated. True if all blocks in the chainstate were validated, false if the chain is based on a snapshot and the snapshot has not yet been validated."},
}
@ STR_HEX
Special string with only hex chars.

Definition at line 3596 of file blockchain.cpp.

◆ scan_action_arg_desc

const auto scan_action_arg_desc
static
Initial value:
"action", RPCArg::Type::STR, RPCArg::Optional::NO, "The action to execute\n"
"\"start\" for starting a scan\n"
"\"abort\" for aborting the current scan (returns true when abort was successful)\n"
"\"status\" for progress report (in %) of the current scan"
}

Definition at line 2316 of file blockchain.cpp.

◆ scan_objects_arg_desc

const auto scan_objects_arg_desc
static
Initial value:
"scanobjects", RPCArg::Type::ARR, RPCArg::Optional::OMITTED, "Array of scan objects. Required for \"start\" action\n"
"Every scan object is either a string descriptor or an object:",
{
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "An output descriptor"},
},
RPCArgOptions{.oneline_description="[scanobjects,...]"},
}
static const auto output_descriptor_obj
std::string oneline_description
Should be empty unless it is supposed to override the auto-generated summary line.
Definition: util.h:170

Definition at line 2331 of file blockchain.cpp.

◆ scan_result_abort

const auto scan_result_abort
static
Initial value:
"when action=='abort'", RPCResult::Type::BOOL, "success",
"True if scan will be aborted (not necessarily before this RPC returns), or false if there is no scan to abort"
}

Definition at line 2341 of file blockchain.cpp.

◆ scan_result_status_none

const auto scan_result_status_none
static
Initial value:
"when action=='status' and no scan is in progress - possibly already completed", RPCResult::Type::NONE, "", ""
}

Definition at line 2345 of file blockchain.cpp.

◆ scan_result_status_some

const auto scan_result_status_some
static
Initial value:
"when action=='status' and a scan is currently in progress", RPCResult::Type::OBJ, "", "",
{{RPCResult::Type::NUM, "progress", "Approximate percent complete"},}
}

Definition at line 2348 of file blockchain.cpp.