Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
blockchain.cpp
Go to the documentation of this file.
125 result.push_back(Pair("chainlock", llmq::chainLocksHandler->HasChainLock(blockindex->nHeight, blockindex->GetBlockHash())));
145 bool chainLock = llmq::chainLocksHandler->HasChainLock(blockindex->nHeight, blockindex->GetBlockHash());
228 "\nReturns the block hash of the best chainlock. Throws an error if there is no known chainlock yet. "
270 "1. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n"
289 cond_blockchange.wait_for(lock, std::chrono::milliseconds(timeout), [&block]{return latestblock.height != block.height || latestblock.hash != block.hash || !IsRPCRunning(); });
291 cond_blockchange.wait(lock, [&block]{return latestblock.height != block.height || latestblock.hash != block.hash || !IsRPCRunning(); });
309 "2. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n"
316 + HelpExampleCli("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862\", 1000")
317 + HelpExampleRpc("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862\", 1000")
330 cond_blockchange.wait_for(lock, std::chrono::milliseconds(timeout), [&hash]{return latestblock.hash == hash || !IsRPCRunning();});
352 "2. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n"
373 cond_blockchange.wait_for(lock, std::chrono::milliseconds(timeout), [&height]{return latestblock.height >= height || !IsRPCRunning();});
375 cond_blockchange.wait(lock, [&height]{return latestblock.height >= height || !IsRPCRunning(); });
406 " \"time\" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT\n"
408 " \"descendantcount\" : n, (numeric) number of in-mempool descendant transactions (including this one)\n"
410 " \"descendantfees\" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one)\n"
411 " \"ancestorcount\" : n, (numeric) number of in-mempool ancestor transactions (including this one)\n"
413 " \"ancestorfees\" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one)\n"
417 " \"instantlock\" : true|false (boolean) True if this transaction was locked via InstantSend\n";
489 "1. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n"
521 "2. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n"
555 mempool.CalculateMemPoolAncestors(*it, setAncestors, noLimit, noLimit, noLimit, noLimit, dummy, false);
585 "2. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n"
701 for (std::vector<uint256>::const_iterator it=blockHashes.begin(); it!=blockHashes.end(); it++) {
738 "\nIf verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.\n"
742 "2. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data\n"
746 " \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n"
752 " \"mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)\n"
756 " \"chainwork\" : \"0000...1f3\" (string) Expected number of hashes required to produce the current chain (in hex)\n"
764 + HelpExampleCli("getblockheader", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
765 + HelpExampleRpc("getblockheader", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
798 "\nReturns an array of items with information about <count> blockheaders starting from <hash>.\n"
799 "\nIf verbose is false, each item is a string that is serialized, hex-encoded data for a single blockheader.\n"
804 "3. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data\n"
808 " \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n"
813 " \"mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)\n"
817 " \"chainwork\" : \"0000...1f3\" (string) Expected number of hashes required to produce the current chain (in hex)\n"
831 + HelpExampleCli("getblockheaders", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\" 2000")
832 + HelpExampleRpc("getblockheaders", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\" 2000")
907 "\nReturns an array of hex-encoded merkleblocks for <count> blocks starting from <hash> which match <filter>.\n"
918 + HelpExampleCli("getmerkleblocks", "\"2303028005802040100040000008008400048141010000f8400420800080025004000004130000000000000001\" \"00000000007e1432d2af52e8463278bf556b55cf5049262f25634557e2e91202\" 2000")
919 + HelpExampleRpc("getmerkleblocks", "\"2303028005802040100040000008008400048141010000f8400420800080025004000004130000000000000001\" \"00000000007e1432d2af52e8463278bf556b55cf5049262f25634557e2e91202\" 2000")
983 "\nIf verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.\n"
985 "If verbosity is 2, returns an Object with information about block <hash> and information about each transaction. \n"
988 "2. verbosity (numeric, optional, default=1) 0 for hex-encoded data, 1 for a json object, and 2 for json object with transaction data\n"
994 " \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n"
1011 " \"mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)\n"
1015 " \"chainwork\" : \"xxxx\", (string) Expected number of hashes required to produce the chain up to this block (in hex)\n"
1023 " \"tx\" : [ (array of Objects) The transactions in the format of the getrawtransaction RPC. Different from verbosity = 1 \"tx\" result.\n"
1029 + HelpExampleCli("getblock", "\"00000000000fd08c2fb661d2fcb0d49abb3a91e5f27082ce64feed3b4dede2e2\"")
1030 + HelpExampleRpc("getblock", "\"00000000000fd08c2fb661d2fcb0d49abb3a91e5f27082ce64feed3b4dede2e2\"")
1074 CCoinsStats() : nHeight(0), nTransactions(0), nTransactionOutputs(0), nBogoSize(0), nDiskSize(0), nTotalAmount(0) {}
1077 static void ApplyStats(CCoinsStats &stats, CHashWriter& ss, const uint256& hash, const std::map<uint32_t, Coin>& outputs)
1089 stats.nBogoSize += 32 /* txid */ + 4 /* vout index */ + 4 /* height + coinbase */ + 8 /* amount */ +
1140 "1. \"height\" (numeric, required) The block height to prune up to. May be set to a discrete height, or a unix timestamp\n"
1163 throw JSONRPCError(RPC_INVALID_PARAMETER, "Could not find block with at least the specified timestamp.");
1173 throw JSONRPCError(RPC_INVALID_PARAMETER, "Blockchain is shorter than the attempted prune height.");
1175 LogPrint(BCLog::RPC, "Attempt to prune blocks close to the tip. Retaining the minimum number of blocks.");
1314 "1. checklevel (numeric, optional, 0-4, default=" + strprintf("%d", nCheckLevel) + ") How thorough the block verification is.\n"
1315 "2. nblocks (numeric, optional, default=" + strprintf("%d", nCheckDepth) + ", 0=all) The number of blocks to check.\n"
1334 static UniValue SoftForkMajorityDesc(int version, CBlockIndex* pindex, const Consensus::Params& consensusParams)
1354 static UniValue SoftForkDesc(const std::string &name, int version, CBlockIndex* pindex, const Consensus::Params& consensusParams)
1363 static UniValue BIP9SoftForkDesc(const Consensus::Params& consensusParams, Consensus::DeploymentPos id)
1395 void BIP9SoftForkDescPushBack(UniValue& bip9_softforks, const Consensus::Params& consensusParams, Consensus::DeploymentPos id)
1401 bip9_softforks.push_back(Pair(VersionBitsDeploymentInfo[id].name, BIP9SoftForkDesc(consensusParams, id)));
1412 " \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n"
1419 " \"initialblockdownload\": xxxx, (bool) (debug information) estimate of whether this node is in Initial Block Download mode.\n"
1421 " \"size_on_disk\": xxxxxx, (numeric) the estimated size of the block and undo files on disk\n"
1423 " \"pruneheight\": xxxxxx, (numeric) lowest-height complete block stored (only present if pruning is enabled)\n"
1424 " \"automatic_pruning\": xx, (boolean) whether automatic pruning is enabled (only present if pruning is enabled)\n"
1425 " \"prune_target_size\": xxxxxx, (numeric) the target size used by pruning (only present if automatic pruning is enabled)\n"
1437 " \"status\": \"xxxx\", (string) one of \"defined\", \"started\", \"locked_in\", \"active\", \"failed\"\n"
1438 " \"bit\": xx, (numeric) the bit (0-28) in the block version field used to signal this softfork (only for \"started\" status)\n"
1439 " \"startTime\": xx, (numeric) the minimum median time past of a block at which the bit gains its meaning\n"
1440 " \"timeout\": xx, (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in\n"
1442 " \"statistics\": { (object) numeric statistics about BIP9 signalling for a softfork (only for \"started\" status)\n"
1444 " \"threshold\": xx, (numeric) the number of blocks with the version bit set required to activate the feature \n"
1445 " \"elapsed\": xx, (numeric) the number of blocks elapsed since the beginning of the current period \n"
1446 " \"count\": xx, (numeric) the number of blocks with the version bit set in the current period \n"
1447 " \"possible\": xx (boolean) returns false if there are not enough blocks left in this period to pass activation threshold \n"
1467 obj.push_back(Pair("verificationprogress", GuessVerificationProgress(Params().TxData(), chainActive.Tip())));
1497 for (int pos = Consensus::DEPLOYMENT_CSV; pos != Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++pos) {
1498 BIP9SoftForkDescPushBack(bip9_softforks, consensusParams, static_cast<Consensus::DeploymentPos>(pos));
1531 "2. branchlen (numeric, optional) only show tips that have equal or greater length of branch\n"
1538 " \"chainwork\" : \"0000...1f3\" (string) Expected number of hashes required to produce the current chain (in hex)\n"
1549 " \"forkpoint\": \"xxxx\", (string) block hash of the last common block between this tip and the main chain\n"
1550 " \"status\": \"xxxx\" (string) status of the chain (active, valid-fork, valid-headers, headers-only, invalid)\n"
1555 "2. \"headers-only\" Not all blocks for this branch are available, but the headers are valid\n"
1556 "3. \"valid-headers\" All blocks are available for this branch, but they were never fully validated\n"
1567 * Idea: the set of chain tips is chainActive.tip, plus orphan blocks which do not have another orphan building off of them.
1569 * - Make one pass through mapBlockIndex, picking out the orphan blocks, and also storing a set of the orphan block's pprev pointers.
1570 * - Iterate through the orphan blocks. If the block isn't pointed to by another orphan, it is a chain tip.
1585 for (std::set<const CBlockIndex*>::iterator it = setOrphans.begin(); it != setOrphans.end(); ++it)
1630 // This block cannot be connected because full block data for it or one of its parents is missing.
1633 // This block is fully validated, but no longer part of the active chain. It was probably the active block once, but was reorganized.
1636 // The headers for this block are valid, but it has not been validated. It was probably never part of the most-work chain.
1658 ret.push_back(Pair("mempoolminfee", ValueFromAmount(std::max(mempool.GetMinFee(maxmempool), ::minRelayTxFee).GetFeePerK())));
1660 ret.push_back(Pair("instantsendlocks", (int64_t)llmq::quorumInstantSendManager->GetInstantSendLockCount()));
1677 " \"mempoolminfee\": xxxxx (numeric) Minimum fee rate in " + CURRENCY_UNIT + "/kB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee\n"
1770 "\nRemoves invalidity status of a block and its descendants, reconsider them for activation.\n"
1809 "1. nblocks (numeric, optional) Size of the window in number of blocks (default: one month).\n"
1813 " \"time\": xxxxx, (numeric) The timestamp for the final block in the window in UNIX format.\n"
1814 " \"txcount\": xxxxx, (numeric) The total number of transactions in the chain up to that point.\n"
1816 " \"window_tx_count\": xxxxx, (numeric) The number of transactions in the window. Only returned if \"window_block_count\" is > 0.\n"
1817 " \"window_interval\": xxxxx, (numeric) The elapsed time in the window in seconds. Only returned if \"window_block_count\" is > 0.\n"
1818 " \"txrate\": x.xx, (numeric) The average rate of transactions per second in the window. Only returned if \"window_interval\" is > 0.\n"
1826 int blockcount = 30 * 24 * 60 * 60 / Params().GetConsensus().nPowTargetSpacing; // By default: 1 month
1858 throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid block count: should be between 0 and the block's height - 1");
1906 static constexpr size_t PER_UTXO_OVERHEAD = sizeof(COutPoint) + sizeof(uint32_t) + sizeof(bool);
1917 "1. \"hash_or_height\" (string or numeric, required) The block hash or height of the target block\n"
1945 " \"total_out\": xxxxx, (numeric) Total amount in all outputs (excluding coinbase and thus reward [ie subsidy + totalfee])\n"
1949 " \"utxo_increase\": xxxxx, (numeric) The increase/decrease in the number of unspent outputs\n"
1950 " \"utxo_size_inc\": xxxxx, (numeric) The increase/decrease in size for the utxo index (not discounting op_return and similar)\n"
1965 throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Target block height %d is negative", height));
1968 throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Target block height %d after current tip %d", height, current_tip));
1982 throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Block is not in chain %s", Params().NetworkIDString()));
2004 SetHasKeys(stats, "utxo_size_inc", "totalfee", "avgfee", "avgfeerate", "minfee", "maxfee", "minfeerate", "maxfeerate");
2007 SetHasKeys(stats, "total_size", "avgtxsize", "mintxsize", "maxtxsize", "avgfeerate", "medianfeerate", "minfeerate", "maxfeerate");
2058 throw JSONRPCError(RPC_INVALID_PARAMETER, "One or more of the selected stats requires -txindex enabled");
2065 throw JSONRPCError(RPC_INTERNAL_ERROR, std::string("Unexpected internal error (tx index seems corrupt)"));
2071 utxo_size_inc -= GetSerializeSize(prevoutput, SER_NETWORK, PROTOCOL_VERSION) + PER_UTXO_OVERHEAD;
2110 ret_all.pushKV("subsidy", pindex->pprev ? GetBlockSubsidy(pindex->pprev->nBits, pindex->pprev->nHeight, Params().GetConsensus()) : 50 * COIN);
2148 "5. verbosity (numeric, optional, default=0) 0 for hashes, 1 for hex-encoded data, and 2 for json object\n"
2162 + HelpExampleCli("getspecialtxes", "\"00000000000fd08c2fb661d2fcb0d49abb3a91e5f27082ce64feed3b4dede2e2\"")
2163 + HelpExampleRpc("getspecialtxes", "\"00000000000fd08c2fb661d2fcb0d49abb3a91e5f27082ce64feed3b4dede2e2\"")
2209 || (nTxType != -1 && tx->nType != nTxType)) { // ensure special tx type matches filter, if given
2276 { "blockchain", "getspecialtxes", &getspecialtxes, {"blockhash", "type", "count", "skip", "verbosity"} },
UniValue getmerkleblocks(const JSONRPCRequest &request)
Definition: blockchain.cpp:902
CAmount GetModFeesWithAncestors() const
Definition: txmempool.h:131
arith_uint256 nChainWork
(memory only) Total amount of work (expected number of hashes) in the chain up to and including this ...
Definition: chain.h:195
bool GetTxPayload(const std::vector< unsigned char > &payload, T &obj)
Definition: specialtx.h:21
CTxMemPool mempool
Definition: transaction.h:16
Definition: versionbits.h:42
uint64_t GetSizeWithAncestors() const
Definition: txmempool.h:130
static bool FlushStateToDisk(const CChainParams &chainParams, CValidationState &state, FlushStateMode mode, int nManualPruneHeight=0)
Update the on-disk chain state.
Definition: validation.cpp:2414
UniValue getmempoolancestors(const JSONRPCRequest &request)
Definition: blockchain.cpp:513
bool GetTransaction(const uint256 &hash, CTransactionRef &txOut, const Consensus::Params &consensusParams, uint256 &hashBlock, bool fAllowSlow, CBlockIndex *blockIndex)
Return transaction in txOut, and if it was found inside a block, its hash is placed in hashBlock...
Definition: validation.cpp:950
Definition: block.h:72
UniValue getbestblockhash(const JSONRPCRequest &request)
Definition: blockchain.cpp:206
Definition: versionbits.h:22
static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE
Default for -maxmempool, maximum megabytes of mempool memory usage.
Definition: policy.h:30
static const CAmount MAX_MONEY
No amount larger than this (in satoshi) is valid.
Definition: amount.h:26
UniValue reconsiderblock(const JSONRPCRequest &request)
Definition: blockchain.cpp:1765
bool VerifyDB(const CChainParams &chainparams, CCoinsView *coinsview, int nCheckLevel, int nCheckDepth)
Definition: validation.cpp:4253
bool InvalidateBlock(CValidationState &state, const CChainParams &chainparams, CBlockIndex *pindex)
Mark a block as invalid.
Definition: validation.cpp:3180
bool HasChainLock(int nHeight, const uint256 &blockHash)
Definition: quorums_chainlocks.cpp:608
size_t GetSerializeSize(const T &t, int nType, int nVersion=0)
Definition: serialize.h:1295
Definition: protocol.h:44
Comparison function for sorting the getchaintips heads.
Definition: blockchain.cpp:1508
static const unsigned int MIN_BLOCKS_TO_KEEP
Block files containing a block-height within MIN_BLOCKS_TO_KEEP of chainActive.Tip() will not be prun...
Definition: validation.h:207
Definition: versionbits.h:23
All parent headers found, difficulty matches, timestamp >= median previous, checkpoint.
Definition: chain.h:134
Definition: util.h:117
BloomFilter is a probabilistic filter which SPV clients provide so that we can filter the transaction...
Definition: bloom.h:46
Definition: versionbits.h:25
std::string HexStr(const T itbegin, const T itend, bool fSpaces=false)
Definition: utilstrencodings.h:100
CAmount GetModFeesWithDescendants() const
Definition: txmempool.h:125
const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS]
Definition: versionbits.cpp:8
static void ApplyStats(CCoinsStats &stats, CHashWriter &ss, const uint256 &hash, const std::map< uint32_t, Coin > &outputs)
Definition: blockchain.cpp:1077
Definition: univalue.h:20
UniValue blockheaderToJSON(const CBlockIndex *blockindex)
Block header to JSON.
Definition: blockchain.cpp:97
BIP9Stats VersionBitsTipStatistics(const Consensus::Params ¶ms, Consensus::DeploymentPos pos)
Get the numerical statistics for the BIP9 state for a given deployment at the current tip...
Definition: validation.cpp:4895
uint64_t GetSizeWithDescendants() const
Definition: txmempool.h:124
double GetDifficulty(const CChain &chain, const CBlockIndex *blockindex)
Definition: blockchain.cpp:64
virtual CCoinsViewCursor * Cursor() const
Get a cursor to iterate over the whole state.
Definition: coins.cpp:14
std::set< txiter, CompareIteratorByHash > setEntries
Definition: txmempool.h:499
void queryHashes(std::vector< uint256 > &vtxid)
Definition: txmempool.cpp:1180
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
Definition: server.cpp:583
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:103
Definition: univalue.h:22
std::string GetWarnings(const std::string &strFor)
Format a string that describes several potential problems detected by the core.
Definition: warnings.cpp:41
uint64_t nPruneTarget
Number of MiB of block files that we're trying to stay below.
Definition: validation.cpp:237
bool appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
Definition: server.cpp:353
UniValue waitfornewblock(const JSONRPCRequest &request)
Definition: blockchain.cpp:262
unsigned int nChainTx
(memory only) Number of transactions in the chain up to and including this block. ...
Definition: chain.h:204
bool ActivateBestChain(CValidationState &state, const CChainParams &chainparams, std::shared_ptr< const CBlock > pblock)
Find the best known block, and make it the tip of the block chain.
Definition: validation.cpp:3072
UniValue getmempooldescendants(const JSONRPCRequest &request)
Definition: blockchain.cpp:577
uint256 ParseHashV(const UniValue &v, std::string strName)
Utilities: convert hex-encoded Values (throws error if not hex).
Definition: server.cpp:121
ThresholdState VersionBitsTipState(const Consensus::Params ¶ms, Consensus::DeploymentPos pos)
Get the BIP9 state for a given deployment at the current tip.
Definition: validation.cpp:4889
static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats)
Calculate statistics about the unspent transaction output set.
Definition: blockchain.cpp:1096
static UniValue getblockstats(const JSONRPCRequest &request)
Definition: blockchain.cpp:1908
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
Definition: txmempool.h:69
Definition: blockchain.cpp:1063
CInstantSendManager * quorumInstantSendManager
Definition: quorums_instantsend.cpp:40
std::unique_ptr< CCoinsViewCache > pcoinsTip
Global variable that points to the active CCoinsView (protected by cs_main)
Definition: validation.cpp:300
static T CalculateTruncatedMedian(std::vector< T > &scores)
Definition: blockchain.cpp:1882
uint32_t nHeight
at which height this containing transaction was included in the active block chain ...
Definition: coins.h:39
Definition: univalue.h:22
static const uint32_t MEMPOOL_HEIGHT
Fake height value used in Coin to signify they are only in the memory pool (since 0...
Definition: txmempool.h:38
Used to relay blocks as header + vector<merkle branch> to filtered nodes.
Definition: merkleblock.h:127
bool operator()(const CBlockIndex *a, const CBlockIndex *b) const
Definition: blockchain.cpp:1510
UniValue pruneblockchain(const JSONRPCRequest &request)
Definition: blockchain.cpp:1134
UniValue waitforblockheight(const JSONRPCRequest &request)
Definition: blockchain.cpp:342
void TxToJSON(const CTransaction &tx, const uint256 hashBlock, UniValue &entry)
Definition: rawtransaction.cpp:48
Scripts & signatures ok. Implies all parents are also at least SCRIPTS.
Definition: chain.h:148
void RegisterBlockchainRPCCommands(CRPCTable &t)
Register block chain RPC commands.
Definition: blockchain.cpp:2293
CFeeRate minRelayTxFee
A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) ...
Definition: validation.cpp:246
CBlockIndex * pindexBestHeader
Best header we've seen so far (used for getheaders queries' starting points).
Definition: validation.cpp:218
std::unique_ptr< CCoinsViewDB > pcoinsdbview
Global variable that points to the coins database (protected by cs_main)
Definition: validation.cpp:299
bool Contains(const CBlockIndex *pindex) const
Efficiently check whether a block is present in this chain.
Definition: chain.h:471
static const unsigned int MAX_HEADERS_RESULTS
Number of headers sent in one getheaders result.
Definition: validation.h:92
CBlockIndex * FindEarliestAtLeast(int64_t nTime) const
Find the earliest block with timestamp equal or greater than the given.
Definition: chain.cpp:62
void CalculateDescendants(txiter it, setEntries &setDescendants)
Populate setDescendants with all in-mempool descendants of hash.
Definition: txmempool.cpp:702
CBlockIndex * Next(const CBlockIndex *pindex) const
Find the successor of a block in this chain, or nullptr if the given index is not found or is the tip...
Definition: chain.h:476
RAII wrapper for VerifyDB: Verify consistency of the block and coin databases.
Definition: validation.h:426
bool IsLocked(const uint256 &txHash)
Definition: quorums_instantsend.cpp:1464
UniValue getchaintxstats(const JSONRPCRequest &request)
Definition: blockchain.cpp:1802
bool IsInitialBlockDownload()
Check whether we are doing an initial block download (synchronizing from disk or network) ...
Definition: validation.cpp:1219
UniValue gettxoutsetinfo(const JSONRPCRequest &request)
Definition: blockchain.cpp:1183
void BIP9SoftForkDescPushBack(UniValue &bip9_softforks, const Consensus::Params &consensusParams, Consensus::DeploymentPos id)
Definition: blockchain.cpp:1395
Definition: blockchain.cpp:49
bool pushKV(const std::string &key, const UniValue &val)
Definition: univalue.cpp:135
int VersionBitsTipStateSinceHeight(const Consensus::Params ¶ms, Consensus::DeploymentPos pos)
Get the block height at which the BIP9 deployment switched into the state for the block building on t...
Definition: validation.cpp:4901
bool CalculateMemPoolAncestors(const CTxMemPoolEntry &entry, setEntries &setAncestors, uint64_t limitAncestorCount, uint64_t limitAncestorSize, uint64_t limitDescendantCount, uint64_t limitDescendantSize, std::string &errString, bool fSearchForParents=true) const
Try to calculate all in-mempool ancestors of entry.
Definition: txmempool.cpp:154
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
Definition: server.cpp:578
UniValue getmempoolentry(const JSONRPCRequest &request)
Definition: blockchain.cpp:641
static std::pair< std::string, UniValue > Pair(const char *cKey, const char *cVal)
Definition: univalue.h:185
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:26
uint64_t GetCountWithDescendants() const
Definition: txmempool.h:123
CFeeRate GetMinFee(size_t sizelimit) const
The minimum fee to get into the mempool, which may itself not be enough for larger-sized transactions...
Definition: txmempool.cpp:1470
static UniValue SoftForkMajorityDesc(int version, CBlockIndex *pindex, const Consensus::Params &consensusParams)
Implementation of IsSuperMajority with better feedback.
Definition: blockchain.cpp:1334
indexed_transaction_set::nth_index< 0 >::type::iterator txiter
Definition: txmempool.h:491
static UniValue SoftForkDesc(const std::string &name, int version, CBlockIndex *pindex, const Consensus::Params &consensusParams)
Definition: blockchain.cpp:1354
Definition: versionbits.h:24
uint64_t GetCountWithAncestors() const
Definition: txmempool.h:129
UniValue invalidateblock(const JSONRPCRequest &request)
Definition: blockchain.cpp:1727
Definition: versionbits.h:21
bool ResetBlockFailureFlags(CBlockIndex *pindex)
Remove invalidity status from a block and its descendants.
Definition: validation.cpp:3218
std::vector< std::pair< unsigned int, uint256 > > vMatchedTxn
Public only for unit testing and relay testing (not relayed).
Definition: merkleblock.h:140
virtual size_t EstimateSize() const
Estimate database size (0 if not implemented)
Definition: coins.h:177
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:170
const CChainParams & Params()
Return the currently selected parameters.
Definition: chainparams.cpp:947
double GuessVerificationProgress(const ChainTxData &data, const CBlockIndex *pindex)
Guess how far we are in the verification process at the given block index.
Definition: validation.cpp:5035
UniValue getblockchaininfo(const JSONRPCRequest &request)
Definition: blockchain.cpp:1404
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
Definition: util.cpp:808
void PruneBlockFilesManual(int nManualPruneHeight)
Prune block files up to a given height.
Definition: validation.cpp:3953
bool PreciousBlock(CValidationState &state, const CChainParams ¶ms, CBlockIndex *pindex)
Mark a block as precious and reorganize.
Definition: validation.cpp:3104
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
Definition: chain.h:453
Definition: server.h:37
void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, UniValue &entry, bool include_hex=true, const CSpentIndexTxInfo *ptxSpentInfo=nullptr)
Definition: core_write.cpp:163
Definition: params.h:18
void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, bool fIncludeHex)
Definition: core_write.cpp:137
CChainLockSig GetBestChainLock()
Definition: quorums_chainlocks.cpp:87
Definition: chain.h:160
void RPCNotifyBlockChange(bool ibd, const CBlockIndex *pindex)
Callback for when block tip changed.
Definition: blockchain.cpp:252
Definition: quorums_chainlocks.h:25
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:198
const Consensus::Params & GetConsensus() const
Definition: chainparams.h:54
bool ReadBlockFromDisk(CBlock &block, const CDiskBlockPos &pos, const Consensus::Params &consensusParams)
Functions for disk access for blocks.
Definition: validation.cpp:1043
CBlockIndex * GetAncestor(int height)
Efficiently find an ancestor of this block.
Definition: chain.cpp:110
CAmount GetBlockSubsidy(int nPrevBits, int nPrevHeight, const Consensus::Params &consensusParams, bool fSuperblockPartOnly)
Definition: validation.cpp:1108
CChain & chainActive
The currently-connected chain of blocks (protected by cs_main).
Definition: validation.cpp:217
AssertLockHeld(g_cs_orphans)
UniValue blockToJSON(const CBlock &block, const CBlockIndex *blockindex, bool txDetails)
Block description to JSON.
Definition: blockchain.cpp:130
Definition: serialize.h:160
UniValue getblockheaders(const JSONRPCRequest &request)
Definition: blockchain.cpp:793
static UniValue BIP9SoftForkDesc(const Consensus::Params &consensusParams, Consensus::DeploymentPos id)
Definition: blockchain.cpp:1363
const CBlockIndex * FindFork(const CBlockIndex *pindex) const
Find the last common block between this chain and a block index entry.
Definition: chain.cpp:51
CCoinsView that brings transactions from a memorypool into view.
Definition: txmempool.h:739
bool GetTimestampIndex(const unsigned int &high, const unsigned int &low, std::vector< uint256 > &hashes)
Definition: validation.cpp:897
static const int64_t TIMESTAMP_WINDOW
Timestamp window used as a grace period by code that compares external timestamps (such as timestamps...
Definition: chain.h:29
static CBlock GetBlockChecked(const CBlockIndex *pblockindex)
Definition: blockchain.cpp:882
CAmount GetFeePerK() const
Return the fee in satoshis for a size of 1000 bytes.
Definition: feerate.h:41
Definition: serialize.h:162
BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS]
Definition: params.h:171
UniValue getbestchainlock(const JSONRPCRequest &request)
Definition: blockchain.cpp:223
const uint256 * phashBlock
pointer to the hash of the block, if any. Memory is owned by this CBlockIndex
Definition: chain.h:174
Definition: server.h:128