Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
blockchain.cpp File Reference
#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...

Enumerations

enum class  CoinStatsHashType

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.
static int ComputeNextBlockAndDepth (const CBlockIndex &tip, const CBlockIndex &blockindex, const CBlockIndex *&next)
static const CBlockIndexParseHashOrHeight (const UniValue &param, ChainstateManager &chainman)
UniValue blockheaderToJSON (const CBlockIndex &tip, const CBlockIndex &blockindex, const uint256 pow_limit)
 Block header to JSON.
UniValue coinbaseTxToJSON (const CTransaction &coinbase_tx)
 Serialize coinbase transaction metadata.
UniValue blockToJSON (BlockManager &blockman, const CBlock &block, const CBlockIndex &tip, const CBlockIndex &blockindex, TxVerbosity verbosity, const uint256 pow_limit)
 Block description to JSON.
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.
static RPCHelpMan pruneblockchain ()
CoinStatsHashType ParseHashType (std::string_view hash_type_input)
static std::optional< kernel::CCoinsStatsGetUTXOStats (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.
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.
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.
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.
static RPCHelpMan loadtxoutset ()
static RPCHelpMan getchainstates ()
void RegisterBlockchainRPCCommands (CRPCTable &t)
std::string MakeUnorderedList (const std::vector< std::string > &items)
 Create an unordered multi-line list of items.

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.
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.
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< RPCResultRPCHelpForChainstate

Enumeration Type Documentation

◆ CoinStatsHashType

enum class kernel::CoinStatsHashType
strong

Definition at line 26 of file coinstats.h.

Function Documentation

◆ blockheaderToJSON()

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

Block header to JSON.

Definition at line 154 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 202 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 1894 of file blockchain.cpp.

Here is the caller graph for this function:

◆ CalculateTruncatedMedian()

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

Definition at line 1879 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 671 of file blockchain.cpp.

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

◆ CheckBlockFilterMatches()

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

Definition at line 2484 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 185 of file blockchain.cpp.

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

◆ ComputeNextBlockAndDepth()

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

Definition at line 116 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 )

Test-only helper to create UTXO snapshots given a chainstate and a file handle.

Returns
a UniValue map containing metadata about the snapshot.

Definition at line 3325 of file blockchain.cpp.

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

◆ dumptxoutset()

RPCHelpMan dumptxoutset ( )
static

Serialize the UTXO set to a file for loading elsewhere.

See also
SnapshotMetadata

Definition at line 3052 of file blockchain.cpp.

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

◆ getbestblockhash()

RPCHelpMan getbestblockhash ( )
static

Definition at line 269 of file blockchain.cpp.

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

◆ getblock()

RPCHelpMan getblock ( )
static

Definition at line 761 of file blockchain.cpp.

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

◆ getblockchaininfo()

RPCHelpMan getblockchaininfo ( )

Definition at line 1364 of file blockchain.cpp.

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

◆ GetBlockChecked()

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

Definition at line 686 of file blockchain.cpp.

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

◆ getblockcount()

RPCHelpMan getblockcount ( )
static

Definition at line 247 of file blockchain.cpp.

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

◆ getblockfilter()

RPCHelpMan getblockfilter ( )
static

Definition at line 2934 of file blockchain.cpp.

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

◆ getblockfrompeer()

RPCHelpMan getblockfrompeer ( )
static

Definition at line 514 of file blockchain.cpp.

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

◆ getblockhash()

RPCHelpMan getblockhash ( )
static

Definition at line 569 of file blockchain.cpp.

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

◆ getblockheader()

RPCHelpMan getblockheader ( )
static

Definition at line 599 of file blockchain.cpp.

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

◆ getblockstats()

RPCHelpMan getblockstats ( )
static

Definition at line 1934 of file blockchain.cpp.

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

◆ getchainstates()

RPCHelpMan getchainstates ( )
static

Definition at line 3437 of file blockchain.cpp.

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

◆ getchaintips()

RPCHelpMan getchaintips ( )
static

Definition at line 1556 of file blockchain.cpp.

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

◆ getchaintxstats()

RPCHelpMan getchaintxstats ( )
static

Definition at line 1787 of file blockchain.cpp.

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

◆ getdeploymentinfo()

RPCHelpMan getdeploymentinfo ( )

Definition at line 1489 of file blockchain.cpp.

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

◆ getdescriptoractivity()

RPCHelpMan getdescriptoractivity ( )
static

Definition at line 2698 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 96 of file blockchain.cpp.

Here is the caller graph for this function:

◆ getdifficulty()

RPCHelpMan getdifficulty ( )
static

Definition at line 493 of file blockchain.cpp.

Here is the call graph for this function:
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 883 of file blockchain.cpp.

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

◆ GetRawBlockChecked()

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

Definition at line 703 of file blockchain.cpp.

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

◆ gettxout()

RPCHelpMan gettxout ( )
static

Definition at line 1182 of file blockchain.cpp.

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

◆ gettxoutsetinfo()

RPCHelpMan gettxoutsetinfo ( )
static

Definition at line 1010 of file blockchain.cpp.

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

◆ GetUndoChecked()

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

Definition at line 718 of file blockchain.cpp.

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

◆ GetUTXOStats()

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 )
static

Calculate statistics about the unspent transaction output set.

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

Definition at line 985 of file blockchain.cpp.

Here is the caller graph for this function:

◆ InvalidateBlock()

void InvalidateBlock ( ChainstateManager & chainman,
const uint256 block_hash )

Definition at line 1695 of file blockchain.cpp.

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

◆ invalidateblock()

RPCHelpMan invalidateblock ( )
static

Definition at line 1716 of file blockchain.cpp.

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

◆ loadtxoutset()

RPCHelpMan loadtxoutset ( )
static

Definition at line 3343 of file blockchain.cpp.

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

◆ MakeUnorderedList()

std::string util::MakeUnorderedList ( const std::vector< std::string > & items)
inline

Create an unordered multi-line list of items.

Definition at line 226 of file string.h.

Here is the caller graph for this function:

◆ ParseHashOrHeight()

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

Definition at line 126 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 967 of file blockchain.cpp.

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

◆ preciousblock()

RPCHelpMan preciousblock ( )
static

Definition at line 1654 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 3209 of file blockchain.cpp.

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

◆ pruneblockchain()

RPCHelpMan pruneblockchain ( )
static

Definition at line 908 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 1741 of file blockchain.cpp.

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

◆ reconsiderblock()

RPCHelpMan reconsiderblock ( )
static

Definition at line 1761 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 3497 of file blockchain.cpp.

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

◆ scanblocks()

RPCHelpMan scanblocks ( )
static

Definition at line 2509 of file blockchain.cpp.

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

◆ scantxoutset()

RPCHelpMan scantxoutset ( )
static

Definition at line 2294 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>
bool SetHasKeys ( const std::set< T > & set)
inlinestatic

Definition at line 1924 of file blockchain.cpp.

Here is the caller graph for this function:

◆ SetHasKeys() [2/2]

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

Definition at line 1926 of file blockchain.cpp.

Here is the call graph for this function:

◆ SoftForkDescPushBack() [1/2]

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

Definition at line 1293 of file blockchain.cpp.

Here is the call graph for this function:

◆ SoftForkDescPushBack() [2/2]

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

Definition at line 1308 of file blockchain.cpp.

Here is the call graph for this function:

◆ syncwithvalidationinterfacequeue()

RPCHelpMan syncwithvalidationinterfacequeue ( )
static

Definition at line 473 of file blockchain.cpp.

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

◆ verifychain()

RPCHelpMan verifychain ( )
static

Definition at line 1262 of file blockchain.cpp.

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

◆ waitforblock()

RPCHelpMan waitforblock ( )
static

Definition at line 349 of file blockchain.cpp.

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

◆ waitforblockheight()

RPCHelpMan waitforblockheight ( )
static

Definition at line 410 of file blockchain.cpp.

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

◆ waitfornewblock()

RPCHelpMan waitfornewblock ( )
static

Definition at line 290 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 3246 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 2229 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 2228 of file blockchain.cpp.

◆ g_scanfilter_in_progress

std::atomic<bool> g_scanfilter_in_progress
static

Definition at line 2459 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 2457 of file blockchain.cpp.

◆ g_scanfilter_progress_height

std::atomic<int> g_scanfilter_progress_height
static

Definition at line 2458 of file blockchain.cpp.

◆ g_scanfilter_should_abort_scan

std::atomic<bool> g_scanfilter_should_abort_scan
static

Definition at line 2460 of file blockchain.cpp.

◆ g_should_abort_scan

std::atomic<bool> g_should_abort_scan
static

Definition at line 2230 of file blockchain.cpp.

◆ getblock_vin

const RPCResult getblock_vin
Initial value:
{
{
{
{RPCResult::Type::ELISION, "", "The same output as verbosity = 2"},
{RPCResult::Type::OBJ, "prevout", "(Only if undo information is available)",
{
{RPCResult::Type::BOOL, "generated", "Coinbase or not"},
{RPCResult::Type::NUM, "height", "The height of the prevout"},
{RPCResult::Type::STR_AMOUNT, "value", "The value in " + CURRENCY_UNIT},
{RPCResult::Type::OBJ, "scriptPubKey", "",
{
{RPCResult::Type::STR, "asm", "Disassembly of the output script"},
{RPCResult::Type::STR, "desc", "Inferred descriptor for the output"},
{RPCResult::Type::STR_HEX, "hex", "The raw output script bytes, hex-encoded"},
{RPCResult::Type::STR, "address", true, "The Bitcoin address (only if a well-defined address exists)"},
{RPCResult::Type::STR, "type", "The type (one of: " + GetAllOutputTypes() + ")"},
}},
}},
}},
}
}
const std::string CURRENCY_UNIT
Definition feerate.h:19
std::string GetAllOutputTypes()
Gets all existing output types formatted for RPC help sections.
Definition util.cpp:46
@ ELISION
Special type to denote elision (...).
Definition util.h:310
@ STR_HEX
Special string with only hex chars.
Definition util.h:306
@ STR_AMOUNT
Special string to represent a floating point amount.
Definition util.h:305

Definition at line 737 of file blockchain.cpp.

◆ output_descriptor_obj

const auto output_descriptor_obj
static
Initial value:
= RPCArg{
"", 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].
Definition util.h:203
@ OMITTED
Optional argument for which the default value is omitted from help text for one of two reasons:
Definition util.h:217
@ NO
Required arg.
Definition util.h:208
UniValue Default
Default constant value.
Definition util.h:222

Definition at line 2263 of file blockchain.cpp.

◆ PER_UTXO_OVERHEAD

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

Definition at line 1932 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."},
}

Definition at line 3424 of file blockchain.cpp.

◆ scan_action_arg_desc

const auto scan_action_arg_desc
static
Initial value:
= RPCArg{
"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 2256 of file blockchain.cpp.

◆ scan_objects_arg_desc

const auto scan_objects_arg_desc
static
Initial value:
= RPCArg{
"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

Definition at line 2271 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 2281 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 2285 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 2288 of file blockchain.cpp.