21 #include <minerfund.h>
60 const CChain &active_chain) {
63 if (height >= 0 && height < active_chain.
Height()) {
64 pb = active_chain[height];
67 if (pb ==
nullptr || !pb->
nHeight) {
85 int64_t maxTime = minTime;
86 for (
int i = 0; i < lookup; i++) {
89 minTime = std::min(time, minTime);
90 maxTime = std::max(time, maxTime);
95 if (minTime == maxTime) {
100 int64_t timeDiff = maxTime - minTime;
108 "Returns the estimated network hashes per second based on the last n "
110 "Pass in [blocks] to override # of blocks, -1 specifies since last "
111 "difficulty change.\n"
112 "Pass in [height] to estimate the network speed at the time when a "
113 "certain block was found.\n",
116 "The number of blocks, or -1 for blocks since last difficulty "
119 "To estimate at the time of the given height."},
129 !request.params[0].isNull() ? request.params[0].get_int() : 120,
130 !request.params[1].isNull() ? request.params[1].get_int() : -1,
137 CBlock &block, uint64_t &max_tries,
144 while (max_tries > 0 &&
145 block.
nNonce < std::numeric_limits<uint32_t>::max() &&
154 if (block.
nNonce == std::numeric_limits<uint32_t>::max()) {
158 std::shared_ptr<const CBlock> shared_pblock =
159 std::make_shared<const CBlock>(block);
164 "ProcessNewBlock, block not accepted");
174 const CScript &coinbase_script,
int nGenerate,
175 uint64_t nMaxTries) {
178 std::unique_ptr<CBlockTemplate> pblocktemplate(
180 .CreateNewBlock(coinbase_script));
182 if (!pblocktemplate.get()) {
186 CBlock *pblock = &pblocktemplate->block;
189 if (!
GenerateBlock(config, chainman, *pblock, nMaxTries, block_hash)) {
193 if (!block_hash.
IsNull()) {
209 Parse(descriptor, key_provider,
error,
false);
211 if (desc->IsRange()) {
213 "Ranged descriptor not accepted. Maybe pass "
214 "through deriveaddresses first?");
218 std::vector<CScript> scripts;
219 if (!desc->Expand(0, key_provider, scripts, provider)) {
222 strprintf(
"Cannot derive script without private keys"));
229 if (scripts.size() == 1) {
230 script = scripts.at(0);
233 script = scripts.at(1);
244 "generatetodescriptor",
245 "Mine blocks immediately to a specified descriptor (before the RPC "
249 "How many blocks are generated immediately."},
251 "The descriptor to send the newly generated bitcoin to."},
253 "How many iterations to try."},
257 "hashes of blocks generated",
265 const int num_blocks{request.params[0].
get_int()};
266 const uint64_t max_tries{request.params[2].isNull()
268 : request.params[2].get_int()};
273 coinbase_script,
error)) {
282 num_blocks, max_tries);
289 "has been replaced by the -generate cli option. Refer to "
290 "-help for more information.",
304 "Mine blocks immediately to a specified address before the "
305 "RPC call returns)\n",
308 "How many blocks are generated immediately."},
310 "The address to send the newly generated bitcoin to."},
312 "How many iterations to try."},
316 "hashes of blocks generated",
321 "\nGenerate 11 blocks to myaddress\n" +
323 "If you are using the " PACKAGE_NAME
" wallet, you can "
324 "get a new address to send the newly generated bitcoin to with:\n" +
328 const int num_blocks{request.params[0].
get_int()};
329 const uint64_t max_tries{request.params[2].isNull()
331 : request.params[2].get_int64()};
334 request.params[1].get_str(), config.GetChainParams());
337 "Error: Invalid address");
347 num_blocks, max_tries);
355 "Mine a block with a set of ordered transactions immediately to a "
356 "specified address or descriptor (before the RPC call returns)\n",
359 "The address or descriptor to send the newly generated bitcoin "
365 "An array of hex strings which are either txids or raw "
367 "Txids must reference transactions currently in the mempool.\n"
368 "All transactions must be valid and in valid order, otherwise "
369 "the block will be rejected.",
384 "\nGenerate a block to myaddress, with txs rawtx and "
387 R
"("myaddress" '["rawtx", "mempool_txid"]')")},
390 const auto address_or_descriptor = request.params[0].
get_str();
394 const CChainParams &chainparams = config.GetChainParams();
398 const auto destination =
402 "Error: Invalid address or descriptor");
411 std::vector<CTransactionRef> txs;
412 const auto raw_txs_or_txids = request.params[1].get_array();
413 for (
size_t i = 0; i < raw_txs_or_txids.size(); i++) {
414 const auto str(raw_txs_or_txids[i].get_str());
419 const auto tx = mempool.
get(
TxId(hash));
423 strprintf(
"Transaction %s not in mempool.", str));
426 txs.emplace_back(tx);
433 strprintf(
"Transaction decode failed for %s", str));
443 std::unique_ptr<CBlockTemplate> blocktemplate(
445 .CreateNewBlock(coinbase_script));
446 if (!blocktemplate) {
448 "Couldn't create new block");
450 block = blocktemplate->block;
456 block.
vtx.insert(block.
vtx.end(), txs.begin(), txs.end());
463 chainman.ActiveChainstate(), block,
469 .withCheckMerkleRoot(
false))) {
471 strprintf(
"TestBlockValidity failed: %s",
498 "Returns a json object containing mining-related "
508 "The block size of the last assembled block (only present if "
509 "a block was ever assembled)"},
511 "The number of block transactions of the last assembled block "
512 "(only present if a block was ever assembled)"},
515 "The network hashes per second"},
518 "current network name (main, test, regtest)"},
520 "any network and blockchain warnings"},
534 if (BlockAssembler::m_last_block_size) {
535 obj.
pushKV(
"currentblocksize",
536 *BlockAssembler::m_last_block_size);
538 if (BlockAssembler::m_last_block_num_txs) {
539 obj.
pushKV(
"currentblocktx",
540 *BlockAssembler::m_last_block_num_txs);
543 obj.
pushKV(
"networkhashps",
545 obj.
pushKV(
"pooledtx", uint64_t(mempool.
size()));
546 obj.
pushKV(
"chain", config.GetChainParams().NetworkIDString());
557 "prioritisetransaction",
558 "Accepts the transaction into mined blocks at a higher "
559 "(or lower) priority\n",
562 "The transaction id."},
564 "API-Compatibility for previous API. Must be zero or null.\n"
565 " DEPRECATED. For forward compatibility "
566 "use named arguments and omit this parameter."},
568 "The fee value (in satoshis) to add (or subtract, if negative).\n"
569 " The fee is not actually paid, only the "
570 "algorithm for selecting transactions into a block\n"
571 " considers the transaction as it would "
572 "have paid a higher (or lower) fee."},
585 if (!(request.params[1].isNull() ||
586 request.params[1].get_real() == 0)) {
589 "Priority is no longer supported, dummy argument to "
590 "prioritisetransaction must be 0.");
614 if (strRejectReason.empty()) {
617 return strRejectReason;
627 "If the request parameters include a 'mode' key, that is used to "
628 "explicitly select between the default 'template' request or a "
630 "It returns data needed to construct a block to work on.\n"
631 "For full specification, see BIPs 22, 23, 9, and 145:\n"
633 "https://github.com/bitcoin/bips/blob/master/"
634 "bip-0022.mediawiki\n"
636 "https://github.com/bitcoin/bips/blob/master/"
637 "bip-0023.mediawiki\n"
639 "https://github.com/bitcoin/bips/blob/master/"
640 "bip-0009.mediawiki#getblocktemplate_changes\n"
646 "Format of the template",
650 "This must be set to \"template\", \"proposal\" (see BIP "
661 "client side supported feature, 'longpoll', "
662 "'coinbasetxn', 'coinbasevalue', 'proposal', "
663 "'serverlist', 'workid'"},
667 "\"template_request\""},
670 RPCResult{
"If the proposal was accepted with mode=='proposal'",
672 RPCResult{
"If the proposal was not accepted with mode=='proposal'",
681 "The preferred block version"},
683 "The hash of current highest block"},
686 "contents of non-coinbase transactions that should be "
687 "included in the next block",
694 "transaction data encoded in hexadecimal "
697 "transaction id encoded in little-endian "
700 "hash encoded in little-endian hexadecimal"},
706 "transactions before this one (by 1-based "
707 "index in 'transactions' list) that must "
708 "be present in the final block if this one "
712 "difference in value between transaction inputs "
713 "and outputs (in satoshis); for coinbase "
714 "transactions, this is a negative Number of the "
715 "total collected block fees (ie, not including "
716 "the block subsidy); "
717 "if key is not present, fee is unknown and "
718 "clients MUST NOT assume there isn't one"},
720 "total sigChecks, as counted for purposes of "
721 "block limits; if key is not present, sigChecks "
722 "are unknown and clients MUST NOT assume it is "
728 "data that should be included in the coinbase's scriptSig "
734 "maximum allowable input to coinbase transaction, "
735 "including the generation award and transaction fees (in "
739 "information for coinbase transaction",
743 "information related to the coinbase miner fund",
748 "List of valid addresses for the miner fund "
755 "The minimum value the miner fund output must "
761 "information related to the coinbase staking reward "
762 "output, only set after the Nov. 15, 2023 upgrade "
763 "activated and the -avalanchestakingrewards option "
769 "The proof payout script",
772 "Decoded payout script"},
774 "Raw payout script in hex format"},
776 "The output type (e.g. " +
779 "The required signatures"},
789 "The minimum value the staking reward output "
796 "The minimum timestamp appropriate for the next block "
797 "time, expressed in " +
801 "list of ways the block template may be changed",
804 "A way the block template may be changed, e.g. "
805 "'time', 'transactions', 'prevblock'"},
808 "A range of valid nonces"},
810 "limit of sigChecks in blocks"},
815 "compressed target of next block"},
817 "The height of the next block"},
828 const CChainParams &chainparams = config.GetChainParams();
830 std::string strMode =
"template";
832 std::set<std::string> setClientRules;
833 Chainstate &active_chainstate = chainman.ActiveChainstate();
835 if (!request.params[0].isNull()) {
838 if (modeval.
isStr()) {
840 }
else if (modeval.
isNull()) {
847 if (strMode ==
"proposal") {
849 if (!dataval.
isStr()) {
852 "Missing data String key for proposal");
858 "Block decode failed");
868 if (pindex->nStatus.isInvalid()) {
869 return "duplicate-invalid";
871 return "duplicate-inconclusive";
878 return "inconclusive-not-best-prevblk";
885 .withCheckMerkleRoot(
true));
890 if (strMode !=
"template") {
897 "Bitcoin is not connected!");
903 " is in initial sync and waiting for blocks...");
906 static unsigned int nTransactionsUpdatedLast;
913 std::chrono::steady_clock::time_point checktxtime;
914 unsigned int nTransactionsUpdatedLastLP;
918 std::string lpstr = lpval.
get_str();
921 ParseHashV(lpstr.substr(0, 64),
"longpollid");
922 nTransactionsUpdatedLastLP =
atoi64(lpstr.substr(64));
927 nTransactionsUpdatedLastLP = nTransactionsUpdatedLast;
933 checktxtime = std::chrono::steady_clock::now() +
934 std::chrono::minutes(1);
939 std::cv_status::timeout) {
944 nTransactionsUpdatedLastLP) {
947 checktxtime += std::chrono::seconds(10);
963 static int64_t nStart;
964 static std::unique_ptr<CBlockTemplate> pblocktemplate;
965 if (pindexPrev != active_chain.
Tip() ||
970 pindexPrev =
nullptr;
982 .CreateNewBlock(scriptDummy);
983 if (!pblocktemplate) {
988 pindexPrev = pindexPrevNew;
993 CBlock *pblock = &pblocktemplate->block;
1006 int index_in_template = 0;
1007 for (
const auto &it : pblock->
vtx) {
1012 index_in_template++;
1014 for (
const auto &o : pblock->
vtx[0]->vout) {
1015 coinbasevalue += o.nValue;
1027 pblocktemplate->entries[index_in_template].fees /
1030 pblocktemplate->entries[index_in_template].sigChecks;
1034 index_in_template++;
1042 for (
const auto &fundDestination :
1048 int64_t minerFundMinValue = 0;
1057 minerFund.
pushKV(
"addresses", minerFundList);
1058 minerFund.
pushKV(
"minimumvalue", minerFundMinValue);
1061 coinbasetxn.
pushKV(
"minerfund", minerFund);
1063 std::vector<CScript> stakingRewardsPayoutScripts;
1066 pindexPrev->
GetBlockHash(), stakingRewardsPayoutScripts)) {
1070 stakingRewardsPayoutScriptObj,
1072 stakingRewards.
pushKV(
"payoutscript",
1073 stakingRewardsPayoutScriptObj);
1078 coinbasetxn.
pushKV(
"stakingrewards", stakingRewards);
1090 result.
pushKV(
"capabilities", aCaps);
1095 result.
pushKV(
"transactions", transactions);
1096 result.
pushKV(
"coinbaseaux", aux);
1097 result.
pushKV(
"coinbasetxn", coinbasetxn);
1098 result.
pushKV(
"coinbasevalue", int64_t(coinbasevalue /
SATOSHI));
1099 result.
pushKV(
"longpollid",
1101 ToString(nTransactionsUpdatedLast));
1105 result.
pushKV(
"mutable", aMutable);
1106 result.
pushKV(
"noncerange",
"00000000ffffffff");
1107 const uint64_t sigCheckLimit =
1109 result.
pushKV(
"sigchecklimit", sigCheckLimit);
1145 "Attempts to submit new block to network.\n"
1146 "See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n",
1149 "the hex-encoded block data to submit"},
1151 "dummy value, for compatibility with BIP22. This value is "
1158 "According to BIP22"},
1164 std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
1165 CBlock &block = *blockptr;
1166 if (!
DecodeHexBlk(block, request.params[0].get_str())) {
1168 "Block decode failed");
1171 if (block.
vtx.empty() || !block.
vtx[0]->IsCoinBase()) {
1173 "Block does not start with a coinbase");
1186 if (pindex->nStatus.isInvalid()) {
1187 return "duplicate-invalid";
1194 std::make_shared<submitblock_StateCatcher>(block.
GetHash());
1201 if (!new_block && accepted) {
1206 return "inconclusive";
1220 "Decode the given hexdata as a header and submit it as a candidate "
1221 "chain tip if valid."
1222 "\nThrows when the header is invalid.\n",
1225 "the hex-encoded block header data"},
1235 "Block header decode failed");
1242 "Must submit previous header (" +
1265 "Estimates the approximate fee per kilobyte needed for a "
1299 for (
const auto &c : commands) {
static bool IsAxionEnabled(const Consensus::Params ¶ms, int32_t nHeight)
static constexpr Amount SATOSHI
std::unique_ptr< avalanche::Processor > g_avalanche
Global avalanche instance.
double GetDifficulty(const CBlockIndex *blockindex)
Calculate the difficulty for a given block index.
@ SCRIPTS
Scripts & signatures ok.
const CChainParams & Params()
Return the currently selected parameters.
#define CHECK_NONFATAL(condition)
Identity function.
std::vector< CTransactionRef > vtx
The block chain is a tree shaped structure starting with the genesis block at the root,...
bool IsValid(enum BlockValidity nUpTo=BlockValidity::TRANSACTIONS) const EXCLUSIVE_LOCKS_REQUIRED(
Check whether this block index entry is valid up to the passed validity level.
CBlockIndex * pprev
pointer to the index of the predecessor of this block
arith_uint256 nChainWork
(memory only) Total amount of work (expected number of hashes) in the chain up to and including this ...
int64_t GetBlockTime() const
int64_t GetMedianTimePast() const
BlockHash GetBlockHash() const
int nHeight
height of the entry in the chain. The genesis block has height 0
An in-memory indexed chain of blocks.
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
int Height() const
Return the maximal height in the chain.
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
const Consensus::Params & GetConsensus() const
size_t GetNodeCount(NumConnections num) const
Amount GetFeePerK() const
Return the fee in satoshis for a size of 1000 bytes.
A mutable version of CTransaction.
void appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
const TxHash GetHash() const
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
CFeeRate estimateFee() const
CTransactionRef get(const TxId &txid) const
void PrioritiseTransaction(const TxId &txid, const Amount nFeeDelta)
Affect CreateNewBlock prioritisation of transactions.
unsigned long size() const
unsigned int GetTransactionsUpdated() const
Implement this to subscribe to events generated in validation.
Chainstate stores and provides an API to update our local knowledge of the current best chain.
CChain m_chain
The current chain of blockheaders we consult and build on.
bool IsInitialBlockDownload() const
Check whether we are doing an initial block download (synchronizing from disk or network)
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
CChain & ActiveChain() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
bool ProcessNewBlock(const Config &config, 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.
bool ProcessNewBlockHeaders(const Config &config, const std::vector< CBlockHeader > &block, bool min_pow_checked, BlockValidationState &state, const CBlockIndex **ppindex=nullptr) LOCKS_EXCLUDED(cs_main)
Process incoming block headers.
node::BlockManager m_blockman
A single BlockManager instance is shared across each constructed chainstate to avoid duplicating bloc...
virtual const CChainParams & GetChainParams() const =0
const std::string & get_str() const
const UniValue & find_value(std::string_view key) const
const UniValue & get_obj() const
void __pushKV(const std::string &key, const UniValue &val)
bool push_back(const UniValue &val)
bool pushKV(const std::string &key, const UniValue &val)
std::string GetRejectReason() const
std::string ToString() const
256-bit unsigned big integer.
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...
std::string GetHex() const
std::string GetHex() const
Generate a new block, without valid proof-of-work.
CBlockIndex * LookupBlockIndex(const BlockHash &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
void BlockChecked(const CBlock &block, const BlockValidationState &stateIn) override
Notifies listeners of a block validation result.
submitblock_StateCatcher(const uint256 &hashIn)
BlockValidationState state
static const uint64_t DEFAULT_MAX_BLOCK_SIZE
Default setting for maximum allowed size for a block, in bytes.
uint64_t GetMaxBlockSigChecksCount(uint64_t maxBlockSize)
Compute the maximum number of sigchecks that can be contained in a block given the MAXIMUM block size...
void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, bool fIncludeHex)
bool DecodeHexTx(CMutableTransaction &tx, const std::string &strHexTx)
bool DecodeHexBlk(CBlock &, const std::string &strHexBlk)
bool ParseHashStr(const std::string &strHex, uint256 &result)
Parse a hex string into 256 bits.
bool DecodeHexBlockHeader(CBlockHeader &, const std::string &hex_header)
std::string EncodeHexTx(const CTransaction &tx, const int serializeFlags=0)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
std::unique_ptr< Descriptor > Parse(const std::string &descriptor, FlatSigningProvider &out, std::string &error, bool require_checksum)
Parse a descriptor string.
std::string EncodeDestination(const CTxDestination &dest, const Config &config)
CTxDestination DecodeDestination(const std::string &addr, const CChainParams ¶ms)
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
Compute the Merkle root of the transactions in a block.
Amount GetMinerFundAmount(const Consensus::Params ¶ms, const Amount &coinbaseValue, const CBlockIndex *pprev)
std::unordered_set< CTxDestination, TxDestinationHasher > GetMinerFundWhitelist(const Consensus::Params ¶ms)
static RPCHelpMan estimatefee()
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...
static RPCHelpMan generateblock()
static RPCHelpMan generatetodescriptor()
static bool getScriptFromDescriptor(const std::string &descriptor, CScript &script, std::string &error)
static UniValue BIP22ValidationResult(const Config &config, const BlockValidationState &state)
static RPCHelpMan getnetworkhashps()
static RPCHelpMan submitblock()
static RPCHelpMan getblocktemplate()
static RPCHelpMan generate()
static RPCHelpMan submitheader()
static UniValue generateBlocks(const Config &config, ChainstateManager &chainman, const CTxMemPool &mempool, const CScript &coinbase_script, int nGenerate, uint64_t nMaxTries)
static RPCHelpMan prioritisetransaction()
static RPCHelpMan getmininginfo()
static RPCHelpMan generatetoaddress()
static bool GenerateBlock(const Config &config, ChainstateManager &chainman, CBlock &block, uint64_t &max_tries, BlockHash &block_hash)
void RegisterMiningRPCCommands(CRPCTable &t)
static const uint64_t DEFAULT_MAX_TRIES
Default max iterations to try in RPC generatetodescriptor, generatetoaddress, and generateblock.
int64_t UpdateTime(CBlockHeader *pblock, const CChainParams &chainParams, const CBlockIndex *pindexPrev)
bool CheckProofOfWork(const BlockHash &hash, uint32_t nBits, const Consensus::Params ¶ms)
Check whether a block hash satisfies the proof-of-work requirement specified by nBits.
static CTransactionRef MakeTransactionRef()
UniValue JSONRPCError(int code, const std::string &message)
@ RPC_OUT_OF_MEMORY
Ran out of memory during operation.
@ RPC_MISC_ERROR
General application defined errors std::exception thrown in command handling.
@ RPC_TYPE_ERROR
Unexpected type was passed as parameter.
@ RPC_CLIENT_NOT_CONNECTED
P2P client errors Bitcoin is not connected.
@ RPC_INVALID_PARAMETER
Invalid, missing or duplicate parameter.
@ RPC_VERIFY_ERROR
General error during transaction or block submission.
@ RPC_CLIENT_IN_INITIAL_DOWNLOAD
Still downloading initial blocks.
@ RPC_DESERIALIZATION_ERROR
Error parsing or validating structure in raw format.
@ RPC_INVALID_ADDRESS_OR_KEY
Invalid address or key.
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
const std::string UNIX_EPOCH_TIME
String used to describe UNIX epoch time in documentation, factored out to a constant for consistency.
std::string GetAllOutputTypes()
uint256 ParseHashV(const UniValue &v, std::string strName)
Utilities: convert hex-encoded values (throws error if not hex).
bool IsRPCRunning()
Query whether RPC is running.
ChainstateManager & EnsureAnyChainman(const std::any &context)
CTxMemPool & EnsureAnyMemPool(const std::any &context)
NodeContext & EnsureAnyNodeContext(const std::any &context)
CConnman & EnsureConnman(const NodeContext &node)
CTxMemPool & EnsureMemPool(const NodeContext &node)
ChainstateManager & EnsureChainman(const NodeContext &node)
bool ShutdownRequested()
Returns true if a shutdown is requested, false otherwise.
bool IsStakingRewardsActivated(const Consensus::Params ¶ms, const CBlockIndex *pprev)
Amount GetStakingRewardsAmount(const Amount &coinbaseValue)
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
std::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
int64_t atoi64(const std::string &str)
std::string ToString(const T &t)
Locale-independent version of std::to_string.
static constexpr Amount zero() noexcept
A BlockHash is a unqiue identifier for a block.
Parameters that influence chain consensus.
int64_t DifficultyAdjustmentInterval() const
@ STR_HEX
Special type that is a STR with only hex chars.
@ OMITTED_NAMED_ARG
Optional arg that is a named argument and has a default value of null.
@ OMITTED
Optional argument with default value omitted because they are implicitly clear.
@ ELISION
Special type to denote elision (...)
@ NUM_TIME
Special numeric to denote unix epoch time.
@ STR_HEX
Special string with only hex chars.
@ STR_AMOUNT
Special string to represent a floating point amount.
A TxId is the identifier of a transaction.
NodeContext struct containing references to chain state and connection state.
#define WAIT_LOCK(cs, name)
#define ENTER_CRITICAL_SECTION(cs)
#define LEAVE_CRITICAL_SECTION(cs)
bool error(const char *fmt, const Args &...args)
NodeClock::time_point GetAdjustedTime()
const UniValue NullUniValue
GlobalMutex g_best_block_mutex
std::condition_variable g_best_block_cv
uint256 g_best_block
Used to notify getblocktemplate RPC of new tips.
bool ContextualCheckTransactionForCurrentBlock(const CBlockIndex *active_chain_tip, const Consensus::Params ¶ms, const CTransaction &tx, TxValidationState &state) EXCLUSIVE_LOCKS_REQUIRED(boo TestBlockValidity)(BlockValidationState &state, const CChainParams ¶ms, Chainstate &chainstate, const CBlock &block, CBlockIndex *pindexPrev, const std::function< NodeClock::time_point()> &adjusted_time_callback, BlockValidationOptions validationOptions) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
This is a variant of ContextualCheckTransaction which computes the contextual check for a transaction...
void UnregisterSharedValidationInterface(std::shared_ptr< CValidationInterface > callbacks)
Unregister subscriber.
void SyncWithValidationInterfaceQueue()
This is a synonym for the following, which asserts certain locks are not held: std::promise<void> pro...
void RegisterSharedValidationInterface(std::shared_ptr< CValidationInterface > callbacks)
Register subscriber.
bilingual_str GetWarnings(bool verbose)
Format a string that describes several potential problems detected by the core.