6 #if defined(HAVE_CONFIG_H) 11 #include <chainparams.h> 34 #include <txmempool.h> 60 if (lookup < -1 || lookup == 0) {
64 if (height < -1 || height > active_chain.
Height()) {
71 pb = active_chain[height];
74 if (pb ==
nullptr || !pb->
nHeight)
87 int64_t maxTime = minTime;
88 for (
int i = 0; i < lookup; i++) {
91 minTime = std::min(time, minTime);
92 maxTime = std::max(time, maxTime);
96 if (minTime == maxTime)
100 int64_t timeDiff = maxTime - minTime;
108 "\nReturns the estimated network hashes per second based on the last n blocks.\n" 109 "Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n" 110 "Pass in [height] to estimate the network speed at the time when a certain block was found.\n",
112 {
"nblocks",
RPCArg::Type::NUM,
RPCArg::Default{120},
"The number of previous blocks to calculate estimate from, or -1 for blocks since last difficulty change."},
142 if (block.
nNonce == std::numeric_limits<uint32_t>::max()) {
146 block_out = std::make_shared<const CBlock>(block);
148 if (!process_new_block)
return true;
162 if (!pblocktemplate.get())
165 std::shared_ptr<const CBlock> block_out;
166 if (!
GenerateBlock(chainman, pblocktemplate->block, nMaxTries, block_out,
true)) {
172 blockHashes.
push_back(block_out->GetHash().GetHex());
181 const auto desc =
Parse(descriptor, key_provider,
error,
false);
183 if (desc->IsRange()) {
188 std::vector<CScript> scripts;
189 if (!desc->Expand(0, key_provider, scripts, provider)) {
196 if (scripts.size() == 1) {
197 script = scripts.at(0);
198 }
else if (scripts.size() == 4) {
200 script = scripts.at(2);
203 script = scripts.at(1);
215 "generatetodescriptor",
216 "Mine to a specified descriptor and return the block hashes.",
229 "\nGenerate 11 blocks to mydesc\n" +
HelpExampleCli(
"generatetodescriptor",
"11 \"mydesc\"")},
232 const auto num_blocks{
self.Arg<
int>(0)};
233 const auto max_tries{
self.Arg<uint64_t>(2)};
245 return generateBlocks(chainman, mempool, coinbase_script, num_blocks, max_tries);
260 "Mine to a specified address and return the block hashes.",
272 "\nGenerate 11 blocks to myaddress\n" 274 +
"If you are using the " PACKAGE_NAME " wallet, you can get a new address to send the newly generated bitcoin to with:\n" 279 const int num_blocks{request.params[0].
getInt<
int>()};
280 const uint64_t max_tries{request.params[2].isNull() ?
DEFAULT_MAX_TRIES : request.params[2].getInt<
int>()};
293 return generateBlocks(chainman, mempool, coinbase_script, num_blocks, max_tries);
301 "Mine a set of ordered transactions to a specified address or descriptor and return the block hash.",
305 "Txids must reference transactions currently in the mempool.\n" 306 "All transactions must be valid and in valid order, otherwise the block will be rejected.",
321 "\nGenerate a block to myaddress, with txs rawtx and mempool_txid\n" 322 +
HelpExampleCli(
"generateblock", R
"("myaddress" '["rawtx", "mempool_txid"]')") 326 const auto address_or_descriptor = request.params[0].
get_str();
342 std::vector<CTransactionRef> txs;
343 const auto raw_txs_or_txids = request.params[1].get_array();
344 for (
size_t i = 0; i < raw_txs_or_txids.size(); i++) {
345 const auto str(raw_txs_or_txids[i].get_str());
351 const auto tx = mempool.
get(hash);
356 txs.emplace_back(tx);
366 const bool process_new_block{request.params[2].isNull() ? true : request.params[2].get_bool()};
374 if (!blocktemplate) {
377 block = blocktemplate->block;
383 block.
vtx.insert(block.
vtx.end(), txs.begin(), txs.end());
395 std::shared_ptr<const CBlock> block_out;
398 if (!
GenerateBlock(chainman, block, max_tries, block_out, process_new_block) || !block_out) {
403 obj.
pushKV(
"hash", block_out->GetHash().GetHex());
404 if (!process_new_block) {
417 "\nReturns a json object containing mining-related information.",
423 {
RPCResult::Type::NUM,
"currentblockweight",
true,
"The block weight of the last assembled block (only present if a block was ever assembled)"},
424 {
RPCResult::Type::NUM,
"currentblocktx",
true,
"The number of block transactions of the last assembled block (only present if a block was ever assembled)"},
445 if (BlockAssembler::m_last_block_weight) obj.
pushKV(
"currentblockweight", *BlockAssembler::m_last_block_weight);
446 if (BlockAssembler::m_last_block_num_txs) obj.
pushKV(
"currentblocktx", *BlockAssembler::m_last_block_num_txs);
449 obj.
pushKV(
"pooledtx", (uint64_t)mempool.
size());
462 "Accepts the transaction into mined blocks at a higher (or lower) priority\n",
466 " DEPRECATED. For forward compatibility use named arguments and omit this parameter."},
468 " Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.\n" 469 " The fee is not actually paid, only the algorithm for selecting transactions into a block\n" 470 " considers the transaction as it would have paid a higher (or lower) fee."},
483 const auto dummy{
self.MaybeArg<
double>(1)};
484 CAmount nAmount = request.params[2].getInt<int64_t>();
486 if (dummy && *dummy != 0) {
498 return RPCHelpMan{
"getprioritisedtransactions",
499 "Returns a map of all user-created (see prioritisetransaction) fee deltas by txid, and whether the tx is present in mempool.",
507 {
RPCResult::Type::NUM,
"modified_fee",
true,
"modified fee in satoshis. Only returned if in_mempool=true"},
522 result_inner.pushKV(
"fee_delta", delta_info.delta);
523 result_inner.pushKV(
"in_mempool", delta_info.in_mempool);
524 if (delta_info.in_mempool) {
525 result_inner.pushKV(
"modified_fee", *delta_info.modified_fee);
527 rpc_result.pushKV(delta_info.txid.GetHex(), result_inner);
546 if (strRejectReason.empty())
548 return strRejectReason;
556 std::string s = vbinfo.
name;
558 s.insert(s.begin(),
'!');
566 "\nIf the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n" 567 "It returns data needed to construct a block to work on.\n" 568 "For full specification, see BIPs 22, 23, 9, and 145:\n" 569 " https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki\n" 570 " https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki\n" 571 " https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n" 572 " https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n",
599 {
RPCResult::Type::STR,
"",
"name of a rule the client must understand to some extent; see BIP 9 for format"},
603 {
RPCResult::Type::NUM,
"rulename",
"identifies the bit number as indicating acceptance and readiness for the named softfork rule"},
609 {
RPCResult::Type::NUM,
"vbrequired",
"bit mask of versionbits the server requires set in submissions"},
611 {
RPCResult::Type::ARR,
"transactions",
"contents of non-coinbase transactions that should be included in the next block",
620 {
RPCResult::Type::NUM,
"",
"transactions before this one (by 1-based index in 'transactions' list) that must be present in the final block if this one is"},
622 {
RPCResult::Type::NUM,
"fee",
"difference in value between transaction inputs and outputs (in satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one"},
623 {
RPCResult::Type::NUM,
"sigops",
"total SigOps cost, as counted for purposes of block limits; if key is not present, sigop cost is unknown and clients MUST NOT assume it is zero"},
624 {
RPCResult::Type::NUM,
"weight",
"total transaction weight, as counted for purposes of block limits"},
631 {
RPCResult::Type::NUM,
"coinbasevalue",
"maximum allowable input to coinbase transaction, including the generation award and transaction fees (in satoshis)"},
632 {
RPCResult::Type::STR,
"longpollid",
"an id to include with a request to longpoll on an update to this template"},
637 {
RPCResult::Type::STR,
"value",
"A way the block template may be changed, e.g. 'time', 'transactions', 'prevblock'"},
647 {
RPCResult::Type::STR_HEX,
"default_witness_commitment",
true,
"a valid witness commitment for the unmodified block template"},
660 std::string strMode =
"template";
662 std::set<std::string> setClientRules;
665 if (!request.params[0].isNull())
671 else if (modeval.
isNull())
679 if (strMode ==
"proposal")
682 if (!dataval.
isStr())
695 return "duplicate-invalid";
696 return "duplicate-inconclusive";
702 return "inconclusive-not-best-prevblk";
710 for (
unsigned int i = 0; i < aClientRules.
size(); ++i) {
711 const UniValue& v = aClientRules[i];
712 setClientRules.insert(v.
get_str());
717 if (strMode !=
"template")
731 static unsigned int nTransactionsUpdatedLast;
738 std::chrono::steady_clock::time_point checktxtime;
739 unsigned int nTransactionsUpdatedLastLP;
744 const std::string& lpstr = lpval.
get_str();
746 hashWatchedChain =
ParseHashV(lpstr.substr(0, 64),
"longpollid");
747 nTransactionsUpdatedLastLP = LocaleIndependentAtoi<int64_t>(lpstr.substr(64));
753 nTransactionsUpdatedLastLP = nTransactionsUpdatedLast;
759 checktxtime = std::chrono::steady_clock::now() + std::chrono::minutes(1);
764 if (
g_best_block_cv.wait_until(lock, checktxtime) == std::cv_status::timeout)
770 checktxtime += std::chrono::seconds(10);
784 if (consensusParams.
signet_blocks && setClientRules.count(
"signet") != 1) {
789 if (setClientRules.count(
"segwit") != 1) {
795 static int64_t time_start;
796 static std::unique_ptr<CBlockTemplate> pblocktemplate;
797 if (pindexPrev != active_chain.
Tip() ||
801 pindexPrev =
nullptr;
810 pblocktemplate =
BlockAssembler{active_chainstate, &mempool}.CreateNewBlock(scriptDummy);
815 pindexPrev = pindexPrevNew;
818 CBlock* pblock = &pblocktemplate->block;
821 UpdateTime(pblock, consensusParams, pindexPrev);
830 std::map<uint256, int64_t> setTxIndex;
832 for (
const auto& it : pblock->
vtx) {
835 setTxIndex[txHash] = i++;
852 entry.
pushKV(
"depends", deps);
854 int index_in_template = i - 1;
855 entry.
pushKV(
"fee", pblocktemplate->vTxFees[index_in_template]);
856 int64_t nTxSigOps = pblocktemplate->vTxSigOpsCost[index_in_template];
861 entry.
pushKV(
"sigops", nTxSigOps);
877 result.
pushKV(
"capabilities", aCaps);
881 if (!fPreSegWit) aRules.
push_back(
"!segwit");
905 if (setClientRules.find(vbinfo.
name) == setClientRules.end()) {
918 if (setClientRules.find(vbinfo.
name) == setClientRules.end()) {
929 result.
pushKV(
"rules", aRules);
930 result.
pushKV(
"vbavailable", vbavailable);
931 result.
pushKV(
"vbrequired",
int(0));
934 result.
pushKV(
"transactions", transactions);
935 result.
pushKV(
"coinbaseaux", aux);
936 result.
pushKV(
"coinbasevalue", (int64_t)pblock->
vtx[0]->vout[0].nValue);
940 result.
pushKV(
"mutable", aMutable);
941 result.
pushKV(
"noncerange",
"00000000ffffffff");
950 result.
pushKV(
"sigoplimit", nSigOpLimit);
951 result.
pushKV(
"sizelimit", nSizeLimit);
963 if (!pblocktemplate->vchCoinbaseCommitment.empty()) {
964 result.
pushKV(
"default_witness_commitment",
HexStr(pblocktemplate->vchCoinbaseCommitment));
994 "\nAttempts to submit new block to network.\n" 995 "See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n",
1010 std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
1011 CBlock& block = *blockptr;
1012 if (!
DecodeHexBlk(block, request.params[0].get_str())) {
1016 if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) {
1021 uint256 hash = block.GetHash();
1030 return "duplicate-invalid";
1039 chainman.UpdateUncommittedBlockStructures(block, pindex);
1044 auto sc = std::make_shared<submitblock_StateCatcher>(block.GetHash());
1046 bool accepted = chainman.
ProcessNewBlock(blockptr,
true,
true, &new_block);
1048 if (!new_block && accepted) {
1052 return "inconclusive";
1062 "\nDecode the given hexdata as a header and submit it as a candidate chain tip if valid." 1063 "\nThrows when the header is invalid.\n",
1114 for (
const auto& c : commands) {
1115 t.appendCommand(c.name, &c);
arith_uint256 nChainWork
(memory only) Total amount of work (expected number of hashes) in the chain up to and including this ...
std::string GetHex() const
node::BlockManager m_blockman
A single BlockManager instance is shared across each constructed chainstate to avoid duplicating bloc...
static UniValue Parse(std::string_view raw)
Parse string to UniValue or throw runtime_error if string contains invalid JSON.
void push_back(UniValue val)
static RPCHelpMan getnetworkhashps()
bool DecodeHexBlk(CBlock &, const std::string &strHexBlk)
std::condition_variable g_best_block_cv
Ran out of memory during operation.
static const int WITNESS_SCALE_FACTOR
int64_t GetBlockTime() const
Generate a new block, without valid proof-of-work.
CBlockIndex * pprev
pointer to the index of the predecessor of this block
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination corresponds to one with an address.
bool IsRPCRunning()
Query whether RPC is running.
BlockValidationState state
std::string GetChainTypeString() const
Return the chain type string.
CTxMemPool & EnsureMemPool(const NodeContext &node)
bool gbt_force
Whether GBT clients can safely ignore this rule in simplified usage.
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
An in-memory indexed chain of blocks.
static UniValue BIP22ValidationResult(const BlockValidationState &state)
static RPCHelpMan getblocktemplate()
CChain & ActiveChain() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
#define CHECK_NONFATAL(condition)
Identity function.
int Height() const
Return the maximal height in the chain.
bool DeploymentActiveAfter(const CBlockIndex *pindexPrev, const Consensus::Params ¶ms, Consensus::BuriedDeployment dep, [[maybe_unused]] VersionBitsCache &versionbitscache)
Determine if a deployment is active for the next block.
void BlockChecked(const CBlock &block, const BlockValidationState &stateIn) override
Notifies listeners of a block validation result.
unsigned long size() const
static bool getScriptFromDescriptor(const std::string &descriptor, CScript &script, std::string &error)
static RPCHelpMan submitheader()
const std::string & get_str() const
ThresholdState
BIP 9 defines a finite-state-machine to deploy a softfork in multiple stages.
void RegisterSharedValidationInterface(std::shared_ptr< CValidationInterface > callbacks)
Register subscriber.
bool DecodeHexBlockHeader(CBlockHeader &, const std::string &hex_header)
CChain m_chain
The current chain of blockheaders we consult and build on.
submitblock_StateCatcher(const uint256 &hashIn)
static const int64_t MAX_BLOCK_SIGOPS_COST
The maximum allowed number of signature check operations in a block (network rule) ...
bool TestBlockValidity(BlockValidationState &state, const CChainParams &chainparams, Chainstate &chainstate, const CBlock &block, CBlockIndex *pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot)
Check a block is completely valid from start to finish (only works on top of our current best block) ...
static int32_t GetTransactionWeight(const CTransaction &tx)
int64_t UpdateTime(CBlockHeader *pblock, const Consensus::Params &consensusParams, const CBlockIndex *pindexPrev)
void UnregisterSharedValidationInterface(std::shared_ptr< CValidationInterface > callbacks)
Unregister subscriber.
Implement this to subscribe to events generated in validation and mempool.
static uint32_t Mask(const Consensus::Params ¶ms, Consensus::DeploymentPos pos)
const std::vector< CTxIn > vin
Invalid, missing or duplicate parameter.
const util::SignalInterrupt & m_interrupt
uint256 g_best_block
Used to notify getblocktemplate RPC of new tips.
VersionBitsCache m_versionbitscache
Track versionbit status.
static const unsigned int MAX_BLOCK_WEIGHT
The maximum allowed weight for a block, see BIP 141 (network rule)
bool ProcessNewBlock(const std::shared_ptr< const CBlock > &block, bool force_processing, bool min_pow_checked, bool *new_block) LOCKS_EXCLUDED(cs_main)
Process an incoming block.
ThresholdState State(const CBlockIndex *pindexPrev, const Consensus::Params ¶ms, Consensus::DeploymentPos pos) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Get the BIP9 state for a given deployment for the block after pindexPrev.
int64_t CAmount
Amount in satoshis (Can be negative)
const UniValue & find_value(std::string_view key) const
uint256 GetBlockHash() const
static std::string gbt_vb_name(const Consensus::DeploymentPos pos)
void RegisterMiningRPCCommands(CRPCTable &t)
General error during transaction or block submission.
std::string ToString(const T &t)
Locale-independent version of std::to_string.
Special type that is a STR with only hex chars.
NodeContext struct containing references to chain state and connection state.
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
UniValue JSONRPCError(int code, const std::string &message)
static RPCHelpMan generatetodescriptor()
Special string with only hex chars.
Chainstate stores and provides an API to update our local knowledge of the current best chain...
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
Scripts & signatures ok. Implies all parents are either at least VALID_SCRIPTS, or are ASSUMED_VALID...
#define LEAVE_CRITICAL_SECTION(cs)
static const uint64_t DEFAULT_MAX_TRIES
Default max iterations to try in RPC generatetodescriptor, generatetoaddress, and generateblock...
An input of a transaction.
Double ended buffer combining vector and stream-like interfaces.
std::string ToString() const
const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS]
Unexpected type was passed as parameter.
bool signet_blocks
If true, witness commitments contain a payload equal to a Bitcoin Script solution to the signet chall...
const Consensus::Params & GetConsensus() const
std::vector< delta_info > GetPrioritisedTransactions() const EXCLUSIVE_LOCKS_REQUIRED(!cs)
Return a vector of all entries in mapDeltas with their corresponding delta_info.
General application defined errors.
std::string DefaultHint
Hint for default value.
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
#define WAIT_LOCK(cs, name)
static RPCHelpMan submitblock()
CTxMemPool & EnsureAnyMemPool(const std::any &context)
Parameters that influence chain consensus.
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params ¶ms)
Check whether a block hash satisfies the proof-of-work requirement specified by nBits.
CBlockIndex * LookupBlockIndex(const uint256 &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
static RPCHelpMan prioritisetransaction()
Special numeric to denote unix epoch time.
256-bit unsigned big integer.
int64_t GetMedianTimePast() const
static RPCHelpMan generateblock()
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
int64_t DifficultyAdjustmentInterval() const
static UniValue generateBlocks(ChainstateManager &chainman, const CTxMemPool &mempool, const CScript &coinbase_script, int nGenerate, uint64_t nMaxTries)
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
#define ENTER_CRITICAL_SECTION(cs)
bool IsValid(enum BlockStatus nUpTo=BLOCK_VALID_TRANSACTIONS) const EXCLUSIVE_LOCKS_REQUIRED(
Check whether this block index entry is valid up to the passed validity level.
const CChainParams & GetParams() const
Optional argument for which the default value is omitted from help text for one of two reasons: ...
size_t GetNodeCount(ConnectionDirection) const
std::string EncodeHexTx(const CTransaction &tx)
std::vector< CTransactionRef > vtx
bilingual_str GetWarnings(bool verbose)
Format a string that describes several potential problems detected by the core.
bool IsTestChain() const
If this chain is exclusively used for testing.
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
const char * name
Deployment name.
bool error(const char *fmt, const Args &... args)
The block chain is a tree shaped structure starting with the genesis block at the root...
const CChainParams & Params()
Return the currently selected parameters.
void pushKV(std::string key, UniValue val)
Serialized script, used inside transaction inputs and outputs.
uint256 ParseHashV(const UniValue &v, std::string_view name)
Utilities: convert hex-encoded Values (throws error if not hex).
static UniValue GetNetworkHashPS(int lookup, int height, const CChain &active_chain)
Return average network hashes per second based on the last 'lookup' blocks, or from the last difficul...
ChainstateManager & EnsureChainman(const NodeContext &node)
const UniValue & get_obj() const
bool IsInitialBlockDownload() const
Check whether we are doing an initial block download (synchronizing from disk or network) ...
std::vector< uint8_t > signet_challenge
static RPCHelpMan generatetoaddress()
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
bool DecodeHexTx(CMutableTransaction &tx, const std::string &hex_tx, bool try_no_witness=false, bool try_witness=true)
std::string GetHex() const
static RPCHelpMan getprioritisedtransactions()
static RPCHelpMan generate()
const UniValue NullUniValue
static RPCHelpMan getmininginfo()
unsigned int GetTransactionsUpdated() const
arith_uint256 & SetCompact(uint32_t nCompact, bool *pfNegative=nullptr, bool *pfOverflow=nullptr)
The "compact" format is a representation of a whole number N using an unsigned 32bit number similar t...
A mutable version of CTransaction.
CTransactionRef get(const uint256 &hash) const
double GetDifficulty(const CBlockIndex &blockindex)
Get the difficulty of the net wrt to the given block index.
static const unsigned int MAX_BLOCK_SERIALIZED_SIZE
The maximum allowed size for a serialized block, in bytes (only for buffer size limits) ...
std::string GetHex() const
bool ParseHashStr(const std::string &strHex, uint256 &result)
Parse a hex string into 256 bits.
The basic transaction that is broadcasted on the network and contained in blocks. ...
int nHeight
height of the entry in the chain. The genesis block has height 0
const Consensus::Params & GetConsensus() const
int bit
Bit position to select the particular bit in nVersion.
Special dictionary with keys that are not literals.
std::string GetRejectReason() const
Still downloading initial blocks.
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg, std::vector< int > *error_locations)
ChainstateManager & EnsureAnyChainman(const std::any &context)
int64_t GetTime()
DEPRECATED, see GetTime.
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate...
void RegenerateCommitments(CBlock &block, ChainstateManager &chainman)
Update an old GenerateCoinbaseCommitment from CreateNewBlock after the block txs have changed...
void PrioritiseTransaction(const uint256 &hash, const CAmount &nFeeDelta)
Affect CreateNewBlock prioritisation of transactions.
SnapshotCompletionResult MaybeCompleteSnapshotValidation() EXCLUSIVE_LOCKS_REQUIRED(const CBlockIndex *GetSnapshotBaseBlock() const EXCLUSIVE_LOCKS_REQUIRED(Chainstate ActiveChainstate)() const
Once the background validation chainstate has reached the height which is the base of the UTXO snapsh...
const Wtxid & GetWitnessHash() const LIFETIMEBOUND
NodeContext & EnsureAnyNodeContext(const std::any &context)
BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS]
Error parsing or validating structure in raw format.
const Txid & GetHash() const LIFETIMEBOUND
CConnman & EnsureConnman(const NodeContext &node)
const std::string UNIX_EPOCH_TIME
String used to describe UNIX epoch time in documentation, factored out to a constant for consistency...
static constexpr TransactionSerParams TX_WITH_WITNESS
GlobalMutex g_best_block_mutex
bool ProcessNewBlockHeaders(const std::vector< CBlockHeader > &block, bool min_pow_checked, BlockValidationState &state, const CBlockIndex **ppindex=nullptr) LOCKS_EXCLUDED(cs_main)
Process incoming block headers.
static bool GenerateBlock(ChainstateManager &chainman, CBlock &block, uint64_t &max_tries, std::shared_ptr< const CBlock > &block_out, bool process_new_block)