Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <rpc/blockchain.h>
#include <amount.h>
#include <chain.h>
#include <chainparams.h>
#include <checkpoints.h>
#include <coins.h>
#include <core_io.h>
#include <consensus/validation.h>
#include <validation.h>
#include <policy/feerate.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <rpc/server.h>
#include <streams.h>
#include <sync.h>
#include <txdb.h>
#include <txmempool.h>
#include <util.h>
#include <utilstrencodings.h>
#include <hash.h>
#include <warnings.h>
#include <evo/specialtx.h>
#include <evo/cbtx.h>
#include <llmq/quorums_chainlocks.h>
#include <llmq/quorums_instantsend.h>
#include <stdint.h>
#include <univalue.h>
#include <boost/algorithm/string.hpp>
#include <boost/thread/thread.hpp>
#include <memory>
#include <mutex>
#include <condition_variable>
Go to the source code of this file.
Classes | |
struct | CUpdatedBlock |
struct | CCoinsStats |
struct | CompareBlocksByHeight |
Comparison function for sorting the getchaintips heads. More... | |
Functions | |
void | TxToJSON (const CTransaction &tx, const uint256 hashBlock, UniValue &entry) |
double | GetDifficulty (const CChain &chain, const CBlockIndex *blockindex) |
double | GetDifficulty (const CBlockIndex *blockindex) |
Get the difficulty of the net wrt to the given block index, or the chain tip if not provided. More... | |
UniValue | blockheaderToJSON (const CBlockIndex *blockindex) |
Block header to JSON. More... | |
UniValue | blockToJSON (const CBlock &block, const CBlockIndex *blockindex, bool txDetails) |
Block description to JSON. More... | |
UniValue | getblockcount (const JSONRPCRequest &request) |
UniValue | getbestblockhash (const JSONRPCRequest &request) |
UniValue | getbestchainlock (const JSONRPCRequest &request) |
void | RPCNotifyBlockChange (bool ibd, const CBlockIndex *pindex) |
Callback for when block tip changed. More... | |
UniValue | waitfornewblock (const JSONRPCRequest &request) |
UniValue | waitforblock (const JSONRPCRequest &request) |
UniValue | waitforblockheight (const JSONRPCRequest &request) |
UniValue | getdifficulty (const JSONRPCRequest &request) |
std::string | EntryDescriptionString () |
void | entryToJSON (UniValue &info, const CTxMemPoolEntry &e) |
UniValue | mempoolToJSON (bool fVerbose) |
Mempool to JSON. More... | |
UniValue | getrawmempool (const JSONRPCRequest &request) |
UniValue | getmempoolancestors (const JSONRPCRequest &request) |
UniValue | getmempooldescendants (const JSONRPCRequest &request) |
UniValue | getmempoolentry (const JSONRPCRequest &request) |
UniValue | getblockhashes (const JSONRPCRequest &request) |
UniValue | getblockhash (const JSONRPCRequest &request) |
UniValue | getblockheader (const JSONRPCRequest &request) |
UniValue | getblockheaders (const JSONRPCRequest &request) |
static CBlock | GetBlockChecked (const CBlockIndex *pblockindex) |
UniValue | getmerkleblocks (const JSONRPCRequest &request) |
UniValue | getblock (const JSONRPCRequest &request) |
static void | ApplyStats (CCoinsStats &stats, CHashWriter &ss, const uint256 &hash, const std::map< uint32_t, Coin > &outputs) |
static bool | GetUTXOStats (CCoinsView *view, CCoinsStats &stats) |
Calculate statistics about the unspent transaction output set. More... | |
UniValue | pruneblockchain (const JSONRPCRequest &request) |
UniValue | gettxoutsetinfo (const JSONRPCRequest &request) |
UniValue | gettxout (const JSONRPCRequest &request) |
UniValue | verifychain (const JSONRPCRequest &request) |
static UniValue | SoftForkMajorityDesc (int version, CBlockIndex *pindex, const Consensus::Params &consensusParams) |
Implementation of IsSuperMajority with better feedback. More... | |
static UniValue | SoftForkDesc (const std::string &name, int version, CBlockIndex *pindex, const Consensus::Params &consensusParams) |
static UniValue | BIP9SoftForkDesc (const Consensus::Params &consensusParams, Consensus::DeploymentPos id) |
void | BIP9SoftForkDescPushBack (UniValue &bip9_softforks, const Consensus::Params &consensusParams, Consensus::DeploymentPos id) |
UniValue | getblockchaininfo (const JSONRPCRequest &request) |
UniValue | getchaintips (const JSONRPCRequest &request) |
UniValue | mempoolInfoToJSON () |
Mempool information to JSON. More... | |
UniValue | getmempoolinfo (const JSONRPCRequest &request) |
UniValue | preciousblock (const JSONRPCRequest &request) |
UniValue | invalidateblock (const JSONRPCRequest &request) |
UniValue | reconsiderblock (const JSONRPCRequest &request) |
UniValue | getchaintxstats (const JSONRPCRequest &request) |
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 UniValue | getblockstats (const JSONRPCRequest &request) |
UniValue | getspecialtxes (const JSONRPCRequest &request) |
UniValue | savemempool (const JSONRPCRequest &request) |
void | RegisterBlockchainRPCCommands (CRPCTable &t) |
Register block chain RPC commands. More... | |
Variables | |
static std::mutex | cs_blockchange |
static std::condition_variable | cond_blockchange |
static CUpdatedBlock | latestblock |
static constexpr size_t | PER_UTXO_OVERHEAD = sizeof(COutPoint) + sizeof(uint32_t) + sizeof(bool) |
static const CRPCCommand | commands [] |
Function Documentation
◆ ApplyStats()
|
static |
Definition at line 1077 of file blockchain.cpp.
References CCoinsStats::nBogoSize, CCoinsStats::nTotalAmount, CCoinsStats::nTransactionOutputs, CCoinsStats::nTransactions, and VARINT.
Referenced by GetUTXOStats().
◆ BIP9SoftForkDesc()
|
static |
Definition at line 1363 of file blockchain.cpp.
References Consensus::BIP9Deployment::bit, BIP9Stats::count, BIP9Stats::elapsed, Consensus::BIP9Deployment::nStartTime, Consensus::BIP9Deployment::nTimeout, Pair(), BIP9Stats::period, BIP9Stats::possible, UniValue::push_back(), BIP9Stats::threshold, THRESHOLD_ACTIVE, THRESHOLD_DEFINED, THRESHOLD_FAILED, THRESHOLD_LOCKED_IN, THRESHOLD_STARTED, Consensus::Params::vDeployments, VersionBitsTipState(), VersionBitsTipStateSinceHeight(), VersionBitsTipStatistics(), and UniValue::VOBJ.
Referenced by BIP9SoftForkDescPushBack().
◆ BIP9SoftForkDescPushBack()
void BIP9SoftForkDescPushBack | ( | UniValue & | bip9_softforks, |
const Consensus::Params & | consensusParams, | ||
Consensus::DeploymentPos | id | ||
) |
Definition at line 1395 of file blockchain.cpp.
References BIP9SoftForkDesc(), name, Consensus::BIP9Deployment::nTimeout, Pair(), UniValue::push_back(), Consensus::Params::vDeployments, and VersionBitsDeploymentInfo.
Referenced by getblockchaininfo().
◆ blockheaderToJSON()
UniValue blockheaderToJSON | ( | const CBlockIndex * | blockindex | ) |
Block header to JSON.
Definition at line 97 of file blockchain.cpp.
References AssertLockHeld(), chainActive, llmq::chainLocksHandler, CChain::Contains(), cs_main, CBlockIndex::GetBlockHash(), GetDifficulty(), base_blob< BITS >::GetHex(), base_uint< BITS >::GetHex(), CBlockIndex::GetMedianTimePast(), CBlockIndex::hashMerkleRoot, CChain::Height(), CBlockIndex::nBits, CBlockIndex::nChainWork, CChain::Next(), CBlockIndex::nHeight, CBlockIndex::nNonce, CBlockIndex::nTime, CBlockIndex::nTx, CBlockIndex::nVersion, Pair(), CBlockIndex::pprev, UniValue::push_back(), strprintf, and UniValue::VOBJ.
Referenced by getblockheader(), getblockheaders(), and rest_headers().
◆ blockToJSON()
UniValue blockToJSON | ( | const CBlock & | block, |
const CBlockIndex * | blockindex, | ||
bool | txDetails | ||
) |
Block description to JSON.
Definition at line 130 of file blockchain.cpp.
References AssertLockHeld(), chainActive, llmq::chainLocksHandler, CChain::Contains(), cs_main, CBlockIndex::GetBlockHash(), CBlockHeader::GetBlockTime(), GetDifficulty(), base_blob< BITS >::GetHex(), base_uint< BITS >::GetHex(), CBlockIndex::GetMedianTimePast(), GetSerializeSize(), GetTxPayload(), llmq::CChainLocksHandler::HasChainLock(), CBlockHeader::hashMerkleRoot, CChain::Height(), llmq::CInstantSendManager::IsLocked(), CBlockHeader::nBits, CBlockIndex::nChainWork, CChain::Next(), CBlockIndex::nHeight, CBlockHeader::nNonce, CBlockIndex::nTx, CBlockHeader::nVersion, Pair(), CBlockIndex::pprev, PROTOCOL_VERSION, UniValue::push_back(), llmq::quorumInstantSendManager, SER_NETWORK, strprintf, CCbTx::ToJson(), TxToUniv(), UniValue::VARR, UniValue::VOBJ, and CBlock::vtx.
Referenced by getblock(), and rest_block().
◆ CalculateTruncatedMedian()
|
static |
Definition at line 1882 of file blockchain.cpp.
Referenced by getblockstats().
◆ EntryDescriptionString()
std::string EntryDescriptionString | ( | ) |
Definition at line 401 of file blockchain.cpp.
References CURRENCY_UNIT.
Referenced by getmempoolancestors(), getmempooldescendants(), getmempoolentry(), and getrawmempool().
◆ entryToJSON()
void entryToJSON | ( | UniValue & | info, |
const CTxMemPoolEntry & | e | ||
) |
Definition at line 420 of file blockchain.cpp.
References AssertLockHeld(), CTxMemPool::cs, CTxMemPool::exists(), CTxMemPoolEntry::GetCountWithAncestors(), CTxMemPoolEntry::GetCountWithDescendants(), CTxMemPoolEntry::GetFee(), CTransaction::GetHash(), CTxMemPoolEntry::GetHeight(), CTxMemPoolEntry::GetModFeesWithAncestors(), CTxMemPoolEntry::GetModFeesWithDescendants(), CTxMemPoolEntry::GetModifiedFee(), CTxMemPoolEntry::GetSizeWithAncestors(), CTxMemPoolEntry::GetSizeWithDescendants(), CTxMemPoolEntry::GetTime(), CTxMemPoolEntry::GetTx(), CTxMemPoolEntry::GetTxSize(), COutPoint::hash, mempool, Pair(), CTxIn::prevout, UniValue::push_back(), llmq::quorumInstantSendManager, base_blob< BITS >::ToString(), ValueFromAmount(), UniValue::VARR, and CTransaction::vin.
Referenced by getmempoolancestors(), getmempooldescendants(), getmempoolentry(), and mempoolToJSON().
◆ getbestblockhash()
UniValue getbestblockhash | ( | const JSONRPCRequest & | request | ) |
Definition at line 206 of file blockchain.cpp.
References chainActive, cs_main, JSONRPCRequest::fHelp, CBlockIndex::GetBlockHash(), base_blob< BITS >::GetHex(), HelpExampleCli(), HelpExampleRpc(), LOCK, JSONRPCRequest::params, UniValue::size(), and CChain::Tip().
◆ getbestchainlock()
UniValue getbestchainlock | ( | const JSONRPCRequest & | request | ) |
Definition at line 223 of file blockchain.cpp.
References llmq::CChainLockSig::blockHash, llmq::chainLocksHandler, cs_main, JSONRPCRequest::fHelp, llmq::CChainLocksHandler::GetBestChainLock(), base_blob< BITS >::GetHex(), HelpExampleCli(), HelpExampleRpc(), llmq::CChainLockSig::IsNull(), JSONRPCError(), LOCK, mapBlockIndex, llmq::CChainLockSig::nHeight, Pair(), JSONRPCRequest::params, UniValue::push_back(), RPC_INTERNAL_ERROR, UniValue::size(), and UniValue::VOBJ.
◆ getblock()
UniValue getblock | ( | const JSONRPCRequest & | request | ) |
Definition at line 978 of file blockchain.cpp.
References CDataStream::begin(), blockToJSON(), cs_main, CDataStream::end(), JSONRPCRequest::fHelp, UniValue::get_bool(), UniValue::get_int(), UniValue::get_str(), GetBlockChecked(), HelpExampleCli(), HelpExampleRpc(), HexStr(), UniValue::isNull(), UniValue::isNum(), JSONRPCError(), LOCK, mapBlockIndex, JSONRPCRequest::params, PROTOCOL_VERSION, RPC_INVALID_ADDRESS_OR_KEY, SER_NETWORK, UniValue::size(), and uint256S().
◆ getblockchaininfo()
UniValue getblockchaininfo | ( | const JSONRPCRequest & | request | ) |
Definition at line 1404 of file blockchain.cpp.
References BIP9SoftForkDescPushBack(), BLOCK_HAVE_DATA, CalculateCurrentUsage(), chainActive, cs_main, Consensus::DEPLOYMENT_CSV, JSONRPCRequest::fHelp, fPruneMode, gArgs, ArgsManager::GetArg(), CBlockIndex::GetBlockHash(), CChainParams::GetConsensus(), GetDifficulty(), base_blob< BITS >::GetHex(), base_uint< BITS >::GetHex(), CBlockIndex::GetMedianTimePast(), GetWarnings(), GuessVerificationProgress(), CChain::Height(), HelpExampleCli(), HelpExampleRpc(), IsInitialBlockDownload(), LOCK, Consensus::MAX_VERSION_BITS_DEPLOYMENTS, CBlockIndex::nChainWork, CBlockIndex::nHeight, nPruneTarget, CBlockIndex::nStatus, Pair(), JSONRPCRequest::params, Params(), pindexBestHeader, CBlockIndex::pprev, UniValue::push_back(), UniValue::size(), SoftForkDesc(), CChain::Tip(), UniValue::VARR, and UniValue::VOBJ.
Referenced by rest_chaininfo().
◆ GetBlockChecked()
|
static |
Definition at line 882 of file blockchain.cpp.
References BLOCK_HAVE_DATA, fHavePruned, JSONRPCError(), CBlockIndex::nStatus, CBlockIndex::nTx, Params(), ReadBlockFromDisk(), and RPC_MISC_ERROR.
Referenced by getblock(), getblockstats(), getmerkleblocks(), and getspecialtxes().
◆ getblockcount()
UniValue getblockcount | ( | const JSONRPCRequest & | request | ) |
Definition at line 189 of file blockchain.cpp.
References chainActive, cs_main, JSONRPCRequest::fHelp, CChain::Height(), HelpExampleCli(), HelpExampleRpc(), LOCK, JSONRPCRequest::params, and UniValue::size().
◆ getblockhash()
UniValue getblockhash | ( | const JSONRPCRequest & | request | ) |
Definition at line 708 of file blockchain.cpp.
References chainActive, cs_main, JSONRPCRequest::fHelp, UniValue::get_int(), CBlockIndex::GetBlockHash(), base_blob< BITS >::GetHex(), CChain::Height(), HelpExampleCli(), HelpExampleRpc(), JSONRPCError(), LOCK, JSONRPCRequest::params, RPC_INVALID_PARAMETER, and UniValue::size().
◆ getblockhashes()
UniValue getblockhashes | ( | const JSONRPCRequest & | request | ) |
Definition at line 674 of file blockchain.cpp.
References JSONRPCRequest::fHelp, UniValue::get_int(), GetTimestampIndex(), HelpExampleCli(), HelpExampleRpc(), high, JSONRPCError(), low, JSONRPCRequest::params, UniValue::push_back(), RPC_INVALID_ADDRESS_OR_KEY, UniValue::size(), and UniValue::VARR.
◆ getblockheader()
UniValue getblockheader | ( | const JSONRPCRequest & | request | ) |
Definition at line 733 of file blockchain.cpp.
References CDataStream::begin(), blockheaderToJSON(), cs_main, CDataStream::end(), JSONRPCRequest::fHelp, UniValue::get_bool(), UniValue::get_str(), CBlockIndex::GetBlockHeader(), HelpExampleCli(), HelpExampleRpc(), HexStr(), UniValue::isNull(), JSONRPCError(), LOCK, mapBlockIndex, JSONRPCRequest::params, PROTOCOL_VERSION, RPC_INVALID_ADDRESS_OR_KEY, SER_NETWORK, UniValue::size(), and uint256S().
◆ getblockheaders()
UniValue getblockheaders | ( | const JSONRPCRequest & | request | ) |
Definition at line 793 of file blockchain.cpp.
References CDataStream::begin(), blockheaderToJSON(), chainActive, cs_main, CDataStream::end(), JSONRPCRequest::fHelp, UniValue::get_bool(), UniValue::get_int(), UniValue::get_str(), CBlockIndex::GetBlockHeader(), HelpExampleCli(), HelpExampleRpc(), HexStr(), UniValue::isNull(), JSONRPCError(), LOCK, mapBlockIndex, MAX_HEADERS_RESULTS, CChain::Next(), JSONRPCRequest::params, PROTOCOL_VERSION, UniValue::push_back(), RPC_INVALID_ADDRESS_OR_KEY, RPC_INVALID_PARAMETER, SER_NETWORK, UniValue::size(), strprintf, uint256S(), and UniValue::VARR.
◆ getblockstats()
|
static |
Definition at line 1908 of file blockchain.cpp.
References CalculateTruncatedMedian(), chainActive, COIN, CChain::Contains(), cs_main, JSONRPCRequest::fHelp, fTxIndex, UniValue::get_array(), UniValue::get_int(), UniValue::get_str(), GetBlockChecked(), CBlockIndex::GetBlockHash(), GetBlockSubsidy(), CBlockIndex::GetBlockTime(), base_blob< BITS >::GetHex(), CBlockIndex::GetMedianTimePast(), GetSerializeSize(), GetTransaction(), COutPoint::hash, CChain::Height(), HelpExampleCli(), HelpExampleRpc(), UniValue::isNull(), UniValue::isNum(), JSONRPCError(), LOCK, mapBlockIndex, MAX_MONEY, MaxBlockSize(), MoneyRange(), COutPoint::n, CBlockIndex::nBits, CBlockIndex::nHeight, CTxOut::nValue, JSONRPCRequest::params, Params(), ParseHashV(), PER_UTXO_OVERHEAD, CBlockIndex::pprev, CTxIn::prevout, PROTOCOL_VERSION, UniValue::pushKV(), RPC_INTERNAL_ERROR, RPC_INVALID_ADDRESS_OR_KEY, RPC_INVALID_PARAMETER, SER_NETWORK, SetHasKeys(), UniValue::size(), strprintf, UniValue::VOBJ, and CBlock::vtx.
◆ getchaintips()
UniValue getchaintips | ( | const JSONRPCRequest & | request | ) |
Definition at line 1522 of file blockchain.cpp.
References BLOCK_FAILED_MASK, BLOCK_VALID_SCRIPTS, BLOCK_VALID_TREE, chainActive, CChain::Contains(), cs_main, JSONRPCRequest::fHelp, CChain::FindFork(), UniValue::get_int(), GetDifficulty(), base_blob< BITS >::GetHex(), HelpExampleCli(), HelpExampleRpc(), UniValue::isNull(), LOCK, mapBlockIndex, CBlockIndex::nHeight, Pair(), JSONRPCRequest::params, CBlockIndex::phashBlock, UniValue::push_back(), UniValue::size(), CChain::Tip(), UniValue::VARR, and UniValue::VOBJ.
◆ getchaintxstats()
UniValue getchaintxstats | ( | const JSONRPCRequest & | request | ) |
Definition at line 1802 of file blockchain.cpp.
References chainActive, CChain::Contains(), cs_main, JSONRPCRequest::fHelp, UniValue::get_int(), UniValue::get_str(), CBlockIndex::GetAncestor(), CChainParams::GetConsensus(), CBlockIndex::GetMedianTimePast(), HelpExampleCli(), HelpExampleRpc(), UniValue::isNull(), JSONRPCError(), LOCK, mapBlockIndex, CBlockIndex::nChainTx, CBlockIndex::nHeight, Consensus::Params::nPowTargetSpacing, CBlockIndex::nTime, Pair(), JSONRPCRequest::params, Params(), UniValue::push_back(), RPC_INVALID_ADDRESS_OR_KEY, RPC_INVALID_PARAMETER, UniValue::size(), CChain::Tip(), uint256S(), and UniValue::VOBJ.
◆ GetDifficulty() [1/2]
double GetDifficulty | ( | const CChain & | chain, |
const CBlockIndex * | blockindex | ||
) |
Definition at line 64 of file blockchain.cpp.
References CBlockIndex::nBits, and CChain::Tip().
Referenced by blockheaderToJSON(), blockToJSON(), getblockchaininfo(), getchaintips(), GetDifficulty(), getdifficulty(), and getmininginfo().
◆ GetDifficulty() [2/2]
double GetDifficulty | ( | const CBlockIndex * | blockindex = nullptr | ) |
Get the difficulty of the net wrt to the given block index, or the chain tip if not provided.
- Returns
- A floating point number that is a multiple of the main net minimum difficulty (4295032833 hashes).
Definition at line 92 of file blockchain.cpp.
References chainActive, and GetDifficulty().
◆ getdifficulty()
UniValue getdifficulty | ( | const JSONRPCRequest & | request | ) |
Definition at line 384 of file blockchain.cpp.
References cs_main, JSONRPCRequest::fHelp, GetDifficulty(), HelpExampleCli(), HelpExampleRpc(), LOCK, JSONRPCRequest::params, and UniValue::size().
◆ getmempoolancestors()
UniValue getmempoolancestors | ( | const JSONRPCRequest & | request | ) |
Definition at line 513 of file blockchain.cpp.
References CTxMemPool::CalculateMemPoolAncestors(), CTxMemPool::cs, EntryDescriptionString(), entryToJSON(), JSONRPCRequest::fHelp, UniValue::get_bool(), CTransaction::GetHash(), CTxMemPoolEntry::GetTx(), HelpExampleCli(), HelpExampleRpc(), UniValue::isNull(), JSONRPCError(), LOCK, CTxMemPool::mapTx, mempool, Pair(), JSONRPCRequest::params, ParseHashV(), UniValue::push_back(), RPC_INVALID_ADDRESS_OR_KEY, UniValue::size(), base_blob< BITS >::ToString(), UniValue::VARR, and UniValue::VOBJ.
◆ getmempooldescendants()
UniValue getmempooldescendants | ( | const JSONRPCRequest & | request | ) |
Definition at line 577 of file blockchain.cpp.
References CTxMemPool::CalculateDescendants(), CTxMemPool::cs, EntryDescriptionString(), entryToJSON(), JSONRPCRequest::fHelp, UniValue::get_bool(), CTransaction::GetHash(), CTxMemPoolEntry::GetTx(), HelpExampleCli(), HelpExampleRpc(), UniValue::isNull(), JSONRPCError(), LOCK, CTxMemPool::mapTx, mempool, Pair(), JSONRPCRequest::params, ParseHashV(), UniValue::push_back(), RPC_INVALID_ADDRESS_OR_KEY, UniValue::size(), base_blob< BITS >::ToString(), UniValue::VARR, and UniValue::VOBJ.
◆ getmempoolentry()
UniValue getmempoolentry | ( | const JSONRPCRequest & | request | ) |
Definition at line 641 of file blockchain.cpp.
References CTxMemPool::cs, EntryDescriptionString(), entryToJSON(), JSONRPCRequest::fHelp, HelpExampleCli(), HelpExampleRpc(), JSONRPCError(), LOCK, CTxMemPool::mapTx, mempool, JSONRPCRequest::params, ParseHashV(), RPC_INVALID_ADDRESS_OR_KEY, UniValue::size(), and UniValue::VOBJ.
◆ getmempoolinfo()
UniValue getmempoolinfo | ( | const JSONRPCRequest & | request | ) |
Definition at line 1665 of file blockchain.cpp.
References CURRENCY_UNIT, JSONRPCRequest::fHelp, HelpExampleCli(), HelpExampleRpc(), mempoolInfoToJSON(), JSONRPCRequest::params, and UniValue::size().
◆ getmerkleblocks()
UniValue getmerkleblocks | ( | const JSONRPCRequest & | request | ) |
Definition at line 902 of file blockchain.cpp.
References chainActive, cs_main, JSONRPCRequest::fHelp, UniValue::get_int(), UniValue::get_str(), GetBlockChecked(), HelpExampleCli(), HelpExampleRpc(), HexStr(), UniValue::isNull(), JSONRPCError(), LOCK, mapBlockIndex, MAX_HEADERS_RESULTS, CChain::Next(), JSONRPCRequest::params, Params(), ParseHex(), PROTOCOL_VERSION, UniValue::push_back(), ReadBlockFromDisk(), RPC_INVALID_ADDRESS_OR_KEY, RPC_INVALID_PARAMETER, RPC_MISC_ERROR, SER_NETWORK, UniValue::size(), strprintf, uint256S(), UniValue::VARR, and CMerkleBlock::vMatchedTxn.
◆ getrawmempool()
UniValue getrawmempool | ( | const JSONRPCRequest & | request | ) |
Definition at line 481 of file blockchain.cpp.
References EntryDescriptionString(), JSONRPCRequest::fHelp, UniValue::get_bool(), HelpExampleCli(), HelpExampleRpc(), UniValue::isNull(), mempoolToJSON(), JSONRPCRequest::params, and UniValue::size().
◆ getspecialtxes()
UniValue getspecialtxes | ( | const JSONRPCRequest & | request | ) |
Definition at line 2134 of file blockchain.cpp.
References cs_main, EncodeHexTx(), JSONRPCRequest::fHelp, UniValue::get_int(), UniValue::get_str(), GetBlockChecked(), HelpExampleCli(), HelpExampleRpc(), UniValue::isNull(), JSONRPCError(), LOCK, mapBlockIndex, JSONRPCRequest::params, UniValue::push_back(), RPC_INTERNAL_ERROR, RPC_INVALID_ADDRESS_OR_KEY, RPC_INVALID_PARAMETER, UniValue::size(), TRANSACTION_NORMAL, TxToJSON(), uint256S(), UniValue::VARR, UniValue::VOBJ, and CBlock::vtx.
◆ gettxout()
UniValue gettxout | ( | const JSONRPCRequest & | request | ) |
Definition at line 1225 of file blockchain.cpp.
References CTxMemPool::cs, cs_main, CURRENCY_UNIT, Coin::fCoinBase, JSONRPCRequest::fHelp, UniValue::get_bool(), UniValue::get_int(), UniValue::get_str(), CBlockIndex::GetBlockHash(), base_blob< BITS >::GetHex(), HelpExampleCli(), HelpExampleRpc(), UniValue::isNull(), CTxMemPool::isSpent(), LOCK, mapBlockIndex, mempool, MEMPOOL_HEIGHT, Coin::nHeight, CBlockIndex::nHeight, NullUniValue, CTxOut::nValue, Coin::out, Pair(), JSONRPCRequest::params, pcoinsTip, UniValue::push_back(), CTxOut::scriptPubKey, ScriptPubKeyToUniv(), UniValue::size(), uint256S(), ValueFromAmount(), and UniValue::VOBJ.
◆ gettxoutsetinfo()
UniValue gettxoutsetinfo | ( | const JSONRPCRequest & | request | ) |
Definition at line 1183 of file blockchain.cpp.
References JSONRPCRequest::fHelp, FlushStateToDisk(), base_blob< BITS >::GetHex(), GetUTXOStats(), CCoinsStats::hashBlock, CCoinsStats::hashSerialized, HelpExampleCli(), HelpExampleRpc(), JSONRPCError(), CCoinsStats::nBogoSize, CCoinsStats::nDiskSize, CCoinsStats::nHeight, CCoinsStats::nTotalAmount, CCoinsStats::nTransactionOutputs, CCoinsStats::nTransactions, Pair(), JSONRPCRequest::params, pcoinsdbview, UniValue::push_back(), RPC_INTERNAL_ERROR, UniValue::size(), ValueFromAmount(), and UniValue::VOBJ.
◆ GetUTXOStats()
|
static |
Calculate statistics about the unspent transaction output set.
Definition at line 1096 of file blockchain.cpp.
References ApplyStats(), cs_main, CCoinsView::Cursor(), error(), CCoinsView::EstimateSize(), CHashWriter::GetHash(), COutPoint::hash, CCoinsStats::hashBlock, CCoinsStats::hashSerialized, LOCK, mapBlockIndex, COutPoint::n, CCoinsStats::nDiskSize, CCoinsStats::nHeight, PROTOCOL_VERSION, and SER_GETHASH.
Referenced by gettxoutsetinfo().
◆ invalidateblock()
UniValue invalidateblock | ( | const JSONRPCRequest & | request | ) |
Definition at line 1727 of file blockchain.cpp.
References ActivateBestChain(), cs_main, JSONRPCRequest::fHelp, UniValue::get_str(), CValidationState::GetRejectReason(), HelpExampleCli(), HelpExampleRpc(), InvalidateBlock(), CValidationState::IsValid(), JSONRPCError(), LOCK, mapBlockIndex, NullUniValue, JSONRPCRequest::params, Params(), RPC_DATABASE_ERROR, RPC_INVALID_ADDRESS_OR_KEY, UniValue::size(), and uint256S().
◆ mempoolInfoToJSON()
UniValue mempoolInfoToJSON | ( | ) |
Mempool information to JSON.
Definition at line 1650 of file blockchain.cpp.
References DEFAULT_MAX_MEMPOOL_SIZE, CTxMemPool::DynamicMemoryUsage(), gArgs, ArgsManager::GetArg(), CFeeRate::GetFeePerK(), CTxMemPool::GetMinFee(), CTxMemPool::GetTotalTxSize(), mempool, minRelayTxFee, Pair(), UniValue::push_back(), llmq::quorumInstantSendManager, CTxMemPool::size(), ValueFromAmount(), and UniValue::VOBJ.
Referenced by getmempoolinfo(), and rest_mempool_info().
◆ mempoolToJSON()
UniValue mempoolToJSON | ( | bool | fVerbose | ) |
Mempool to JSON.
Definition at line 453 of file blockchain.cpp.
References CTxMemPool::cs, entryToJSON(), CTransaction::GetHash(), CTxMemPoolEntry::GetTx(), LOCK, CTxMemPool::mapTx, mempool, Pair(), UniValue::push_back(), CTxMemPool::queryHashes(), base_blob< BITS >::ToString(), UniValue::VARR, and UniValue::VOBJ.
Referenced by getrawmempool(), and rest_mempool_contents().
◆ preciousblock()
UniValue preciousblock | ( | const JSONRPCRequest & | request | ) |
Definition at line 1689 of file blockchain.cpp.
References cs_main, JSONRPCRequest::fHelp, UniValue::get_str(), CValidationState::GetRejectReason(), HelpExampleCli(), HelpExampleRpc(), CValidationState::IsValid(), JSONRPCError(), LOCK, mapBlockIndex, NullUniValue, JSONRPCRequest::params, Params(), PreciousBlock(), RPC_DATABASE_ERROR, RPC_INVALID_ADDRESS_OR_KEY, UniValue::size(), and uint256S().
◆ pruneblockchain()
UniValue pruneblockchain | ( | const JSONRPCRequest & | request | ) |
Definition at line 1134 of file blockchain.cpp.
References chainActive, cs_main, JSONRPCRequest::fHelp, CChain::FindEarliestAtLeast(), fPruneMode, UniValue::get_int(), CChain::Height(), HelpExampleCli(), HelpExampleRpc(), JSONRPCError(), LOCK, LogPrint, MIN_BLOCKS_TO_KEEP, CBlockIndex::nHeight, JSONRPCRequest::params, Params(), PruneBlockFilesManual(), BCLog::RPC, RPC_INVALID_PARAMETER, RPC_MISC_ERROR, UniValue::size(), and TIMESTAMP_WINDOW.
◆ reconsiderblock()
UniValue reconsiderblock | ( | const JSONRPCRequest & | request | ) |
Definition at line 1765 of file blockchain.cpp.
References ActivateBestChain(), cs_main, JSONRPCRequest::fHelp, UniValue::get_str(), CValidationState::GetRejectReason(), HelpExampleCli(), HelpExampleRpc(), CValidationState::IsValid(), JSONRPCError(), LOCK, mapBlockIndex, NullUniValue, JSONRPCRequest::params, Params(), ResetBlockFailureFlags(), RPC_DATABASE_ERROR, RPC_INVALID_ADDRESS_OR_KEY, UniValue::size(), and uint256S().
◆ RegisterBlockchainRPCCommands()
void RegisterBlockchainRPCCommands | ( | CRPCTable & | t | ) |
Register block chain RPC commands.
Definition at line 2293 of file blockchain.cpp.
References CRPCTable::appendCommand(), ARRAYLEN, commands, and CRPCCommand::name.
Referenced by RegisterAllCoreRPCCommands().
◆ RPCNotifyBlockChange()
void RPCNotifyBlockChange | ( | bool | ibd, |
const CBlockIndex * | |||
) |
Callback for when block tip changed.
Definition at line 252 of file blockchain.cpp.
References cond_blockchange, cs_blockchange, CBlockIndex::GetBlockHash(), CUpdatedBlock::hash, CUpdatedBlock::height, latestblock, and CBlockIndex::nHeight.
Referenced by AppInitMain(), OnRPCStarted(), and OnRPCStopped().
◆ savemempool()
UniValue savemempool | ( | const JSONRPCRequest & | request | ) |
Definition at line 2235 of file blockchain.cpp.
References DumpMempool(), JSONRPCRequest::fHelp, HelpExampleCli(), HelpExampleRpc(), JSONRPCError(), NullUniValue, JSONRPCRequest::params, RPC_MISC_ERROR, and UniValue::size().
◆ SetHasKeys() [1/2]
|
inlinestatic |
Definition at line 1898 of file blockchain.cpp.
Referenced by getblockstats(), and SetHasKeys().
◆ SetHasKeys() [2/2]
|
inlinestatic |
Definition at line 1900 of file blockchain.cpp.
References count, and SetHasKeys().
◆ SoftForkDesc()
|
static |
Definition at line 1354 of file blockchain.cpp.
References name, Pair(), UniValue::push_back(), SoftForkMajorityDesc(), and UniValue::VOBJ.
Referenced by getblockchaininfo().
◆ SoftForkMajorityDesc()
|
static |
Implementation of IsSuperMajority with better feedback.
Definition at line 1334 of file blockchain.cpp.
References Consensus::Params::BIP34Height, Consensus::Params::BIP65Height, Consensus::Params::BIP66Height, CBlockIndex::nHeight, Pair(), UniValue::push_back(), and UniValue::VOBJ.
Referenced by SoftForkDesc().
◆ TxToJSON()
void TxToJSON | ( | const CTransaction & | tx, |
const uint256 | hashBlock, | ||
UniValue & | entry | ||
) |
Definition at line 48 of file rawtransaction.cpp.
References chainActive, llmq::chainLocksHandler, CChain::Contains(), CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockTime(), CTransaction::GetHash(), base_blob< BITS >::GetHex(), GetSpentIndex(), llmq::CChainLocksHandler::HasChainLock(), CChain::Height(), CTransaction::IsCoinBase(), llmq::CInstantSendManager::IsLocked(), base_blob< BITS >::IsNull(), mapBlockIndex, CSpentIndexTxInfo::mSpentInfo, CBlockIndex::nHeight, Pair(), UniValue::push_back(), llmq::quorumInstantSendManager, TxToUniv(), CTransaction::vin, and CTransaction::vout.
Referenced by getrawtransaction(), and getspecialtxes().
◆ verifychain()
UniValue verifychain | ( | const JSONRPCRequest & | request | ) |
Definition at line 1305 of file blockchain.cpp.
References cs_main, DEFAULT_CHECKBLOCKS, DEFAULT_CHECKLEVEL, JSONRPCRequest::fHelp, gArgs, UniValue::get_int(), ArgsManager::GetArg(), HelpExampleCli(), HelpExampleRpc(), UniValue::isNull(), LOCK, JSONRPCRequest::params, Params(), pcoinsTip, UniValue::size(), strprintf, and CVerifyDB::VerifyDB().
◆ waitforblock()
UniValue waitforblock | ( | const JSONRPCRequest & | request | ) |
Definition at line 300 of file blockchain.cpp.
References cond_blockchange, cs_blockchange, JSONRPCRequest::fHelp, UniValue::get_int(), UniValue::get_str(), base_blob< BITS >::GetHex(), CUpdatedBlock::hash, CUpdatedBlock::height, HelpExampleCli(), HelpExampleRpc(), UniValue::isNull(), IsRPCRunning(), latestblock, Pair(), JSONRPCRequest::params, UniValue::push_back(), UniValue::size(), uint256S(), and UniValue::VOBJ.
◆ waitforblockheight()
UniValue waitforblockheight | ( | const JSONRPCRequest & | request | ) |
Definition at line 342 of file blockchain.cpp.
References cond_blockchange, cs_blockchange, JSONRPCRequest::fHelp, UniValue::get_int(), base_blob< BITS >::GetHex(), CUpdatedBlock::hash, CUpdatedBlock::height, HelpExampleCli(), HelpExampleRpc(), UniValue::isNull(), IsRPCRunning(), latestblock, Pair(), JSONRPCRequest::params, UniValue::push_back(), UniValue::size(), and UniValue::VOBJ.
◆ waitfornewblock()
UniValue waitfornewblock | ( | const JSONRPCRequest & | request | ) |
Definition at line 262 of file blockchain.cpp.
References cond_blockchange, cs_blockchange, JSONRPCRequest::fHelp, UniValue::get_int(), base_blob< BITS >::GetHex(), CUpdatedBlock::hash, CUpdatedBlock::height, HelpExampleCli(), HelpExampleRpc(), UniValue::isNull(), IsRPCRunning(), latestblock, Pair(), JSONRPCRequest::params, UniValue::push_back(), UniValue::size(), and UniValue::VOBJ.
Variable Documentation
◆ commands
|
static |
Definition at line 2254 of file blockchain.cpp.
Referenced by RegisterBlockchainRPCCommands().
◆ cond_blockchange
|
static |
Definition at line 56 of file blockchain.cpp.
Referenced by RPCNotifyBlockChange(), waitforblock(), waitforblockheight(), and waitfornewblock().
◆ cs_blockchange
|
static |
Definition at line 55 of file blockchain.cpp.
Referenced by RPCNotifyBlockChange(), waitforblock(), waitforblockheight(), and waitfornewblock().
◆ latestblock
|
static |
Definition at line 57 of file blockchain.cpp.
Referenced by RPCNotifyBlockChange(), waitforblock(), waitforblockheight(), and waitfornewblock().
◆ PER_UTXO_OVERHEAD
|
static |
Definition at line 1906 of file blockchain.cpp.
Referenced by getblockstats().