Full‐node components that run the block, chainstate, and mempool machinery.

Types

Name

Description

BlockAssembler

Generate a new block, without valid proof‐of‐work

BlockCheckOptions

Options controlling which checks a block‐template validity check performs.

BlockCreateOptions

Block template creation options. These override node defaults, but can't exceed node limits (e.g. block_reserved_weight can't exceed max block weight).

BlockManager

Maintains a tree of blocks (stored in m_block_index) which is consulted to determine where the most‐work tip is.

BlockWaitOptions

Options controlling how long a block‐template wait call blocks and when it returns.

BlockfileCursor

Tracks the current block file and how far its undo data has been written.

CBlockIndexHeightOnlyComparator

Orders block indices purely by height, without tie‐breaking.

CBlockIndexWorkComparator

Orders block indices by most accumulated work, for choosing the best tip.

CBlockTemplate

A candidate block together with the per‐transaction data needed to finalize it.

CacheSizes

Cache sizes split between the optional indexes and the kernel (validation) caches.

ChainstateLoadOptions

Options controlling how the chainstate is loaded and verified.

CoinbaseTx

Template containing all coinbase transaction fields that are set by our miner code. Clients are expected to add their own outputs and typically also expand the scriptSig.

ImportMempoolOptions

Options controlling how a persisted mempool file is imported.

IndexCacheSizes

Cache sizes allotted to each optional block‐chain index.

IteratorComparator

Comparator ordering map iterators by their key, for use in ordered sets of iterators.

KernelNotifications

Kernel notification handler that tracks chain state for code above the validation layer.

KernelState

State tracked by the KernelNotifications interface meant to be used by mining code, index code, RPCs, and other code sitting above the validation layer.

MiniMiner

A minimal version of BlockAssembler, using the same ancestor set scoring algorithm. Allows us to run this algorithm on a limited set of transactions (e.g. subset of mempool or transactions that are not yet in mempool) instead of the entire mempool, ignoring consensus rules. Callers may use this to: ‐ Calculate the "bump fee" needed to spend an unconfirmed UTXO at a given feerate ‐ "Linearize" a list of transactions to see the order in which they would be selected for inclusion in a block

MiniMinerMempoolEntry

Container for tracking updates to ancestor feerate as we include ancestors in the "block".

NodeContext

NodeContext struct containing references to chain state and connection state.

PSBTAnalysis

Holds the results of AnalyzePSBT (miscellaneous information about a PSBT)

PSBTInputAnalysis

Holds an analysis of one input from a PSBT

PackageToValidate

A parent/child transaction package queued for joint mempool validation.

PruneLockInfo

Records the oldest block an external component still needs, to guard it from pruning.

RejectedTxTodo

Follow‐up actions returned after a transaction is rejected from the mempool.

SnapshotMetadata

Metadata describing a serialized UTXO snapshot file.

TxDownloadConnectionInfo

Per‐peer connection attributes that affect transaction download scheduling.

TxDownloadManager

Class responsible for deciding what transactions to request and, once downloaded, whether and how to validate them. It is also responsible for deciding what transaction packages to validate and how to resolve orphan transactions. Its data structures include TxRequestTracker for scheduling requests, rolling bloom filters for remembering transactions that have already been {accepted, rejected, confirmed}, an orphanage, and a registry of each peer's transaction relay‐related information.

TxDownloadManagerImpl

Private implementation of TxDownloadManager.

TxDownloadOptions

Options used to construct a TxDownloadManager.

TxOrphanage

A class to track orphan transactions (failed on TX_MISSING_INPUTS) Since we cannot distinguish orphans from bad transactions with non‐existent inputs, we heavily limit the amount of announcements (unique (NodeId, wtxid) pairs), the number of inputs, and size of the orphans stored (both individual and summed). We also try to prevent adversaries from churning this data structure: once global limits are reached, we continuously evict the oldest announcement (sorting non‐reconsiderable orphans before reconsiderable ones) from the most resource‐intensive peer until we are back within limits. ‐ Peers can exceed their individual limits (e.g. because they are very useful transaction relay peers) as long as the global limits are not exceeded. ‐ As long as the orphan has 1 announcer, it remains in the orphanage. ‐ No peer can trigger the eviction of another peer's orphans. ‐ Peers' orphans are effectively protected from eviction as long as they don't exceed their limits. Not thread‐safe. Requires external synchronization.

Warnings

Manages warning messages within a node.

Type Aliases

Name

Description

BlockMap

Map from block hash to its in‐memory block index entry.

ChainstateLoadResult

Chainstate load status code and optional error string.

Enums

Name

Description

BlockfileType

Which kind of chainstate a block file belongs to, used to segment storage.

ChainstateLoadStatus

Chainstate load status. Simple applications can just check for the success case, and treat other cases as errors. More complex applications may want to try reindexing in the generic failure case, and pass an interrupt callback and exit cleanly in the interrupted case.

ReadRawError

Reason a raw block read from disk failed.

TransactionError

Result of attempting to submit or broadcast a transaction.

TxBroadcast

How to broadcast a local transaction. Used to influence BroadcastTransaction() and its callers.

Warning

Categories of node‐level warning shown to the user and over RPC.

Functions

Name

Description

AbortNode

Abort the node in response to a fatal, unrecoverable internal error.

AddMerkleRootAndCoinbase

Insert the coinbase transaction and compute the merkle root of a block.

AnalyzePSBT

Provides helpful miscellaneous information about where a PSBT is in the signing workflow.

ApplyArgsManOptions

ApplyArgsManOptions overloads

BroadcastTransaction

Submit a transaction to the mempool and (optionally) relay it to all P2P peers.

CalculateCacheSizes

Split the configured total database cache across the indexes and kernel caches.

CheckMiningOptions

Check option values for validity. Returns an error for invalid values.

CooldownIfHeadersAhead

Wait while the best known header extends the current chain tip AND at least one block is being added to the tip every 3 seconds. If the tip is sufficiently far behind, allow up to 20 seconds for the next tip update.

DumpMempool

Dump the mempool to a file.

FindAssumeutxoChainstateDir

Return a path to the snapshot‐based chainstate dir, if one exists.

FindCoins

Look up unspent output information. Returns coins in the mempool and in the current chain UTXO set. Iterates through all the keys in the map and populates the values.

FlattenMiningOptions

Replace null optional values with their hardcoded defaults.

GetDefaultDBCache

Return the default total database cache size in bytes.

GetMinimumTime

Get the minimum time a miner should use in the next block. This always accounts for the BIP94 timewarp rule, so does not necessarily reflect the consensus limit.

GetTip

Return the hash and height of the active chain tip.

GetTransaction

Return transaction with a given hash. If mempool is provided and block_index is not provided, check it first for the tx. If ‐txindex is available, check it next for the tx. Finally, if block_index is provided, check for tx by reading entire block from disk.

GetWarningsForRpc

RPC helper function that wraps warnings.GetMessages().

ImportBlocks

Load blocks from the given files and activate the best chain, even if none are imported.

InterruptWait

Interrupt a blocking wait call.

LoadChainstate

This sequence can have 4 types of outcomes:

LoadMempool

Import the file and attempt to add its contents to the mempool.

LogOversizedDbCache

Log a warning when the configured database cache is larger than available RAM allows.

MakeMinisketch32

Wrapper around Minisketch::Minisketch(32, implementation, capacity).

MakeMinisketch32FP

Wrapper around Minisketch::CreateFP.

MakeTxOrphanage

MakeTxOrphanage overloads

MempoolPath

Return the on‐disk path used to load and save the persisted mempool.

MergeMiningOptions

Merge two BlockCreateOptions structs, replacing null values in x with non‐null values from y.

ReadCoinsViewArgs

Read coins‐view database options from the argument manager.

ReadDatabaseArgs

Read database options from the argument manager.

ReadMiningArgs

Read the mining options set in args. Returns an error if one was encountered.

ReadNotificationArgs

Apply notification‐related options from the argument manager.

ReadSnapshotBaseBlockhash

Read the blockhash of the snapshot base block that was used to construct the chainstate.

RegenerateCommitments

Update an old GenerateCoinbaseCommitment from CreateNewBlock after the block txs have changed

ShouldPersistMempool

Determine whether the mempool should be persisted across restarts.

ShouldWarnOversizedDbCache

Report whether the configured database cache is large enough to warrant a warning.

SubmitBlock

Submit a block and capture the validation state via the BlockChecked callback. Returns whether the block was accepted as a new valid block.

UpdateTime

Update a block header's time field and return the new time.

VerifyLoadedChainstate

Verify a chainstate that has already been loaded.

WaitAndCreateNewBlock

Return a new block template when fees rise to a certain threshold or after a new tip; return nullopt if timeout is reached.

WaitTipChanged

Waits for the connected tip to change until timeout has elapsed. During node initialization, this will wait until the tip is connected (regardless of timeout). Returns the current tip, or nullopt if the node is shutting down or interrupt() is called.

WriteSnapshotBaseBlockhash

Write out the blockhash of the snapshot base block that was used to construct this chainstate. This value is read in during subsequent initializations and used to reconstruct snapshot‐based chainstates.

operator<<

Stream insertion operators

Variables

Name

Description

BLOCKFILE_CHUNK_SIZE

The pre‐allocation chunk size for blk?????.dat files (since 0.8)

DEFAULT_MAX_BURN_AMOUNT

Maximum burn value for sendrawtransaction, submitpackage, and testmempoolaccept RPC calls. By default, a transaction with a burn value higher than this will be rejected by these RPCs and the GUI. This can be overridden with the maxburnamount argument.

DEFAULT_MAX_ORPHANAGE_LATENCY_SCORE

Default value for TxOrphanage::m_max_global_latency_score. Helps limit the maximum latency for operations like EraseForBlock and LimitOrphans.

DEFAULT_MAX_RAW_TX_FEE_RATE

Maximum fee rate for sendrawtransaction and testmempoolaccept RPC calls. Also used by the GUI when broadcasting a completed PSBT. By default, a transaction with a fee rate higher than this will be rejected by these RPCs and the GUI. This can be overridden with the maxfeerate argument.

DEFAULT_PERSIST_MEMPOOL

Default for ‐persistmempool, indicating whether the node should attempt to automatically load the mempool on start and save to disk on shutdown

DEFAULT_PRINT_MODIFIED_FEE

Default for whether block templates print each transaction's modified fee.

DEFAULT_RESERVED_ORPHAN_WEIGHT_PER_PEER

Default value for TxOrphanage::m_reserved_usage_per_peer. Helps limit the total amount of memory used by the orphanage.

DEFAULT_STOPATHEIGHT

Default for ‐stopatheight; 0 means never stop at a given height.

GETDATA_TX_INTERVAL

How long to wait before downloading a transaction from an additional peer

MAX_BLOCKFILE_SIZE

The maximum size of a blk?????.dat file (since 0.8)

MAX_PEER_TX_ANNOUNCEMENTS

Maximum number of transactions to consider for requesting, per peer. It provides a reasonable DoS limit to per‐peer memory usage spent on announcements, while covering peers continuously sending INVs at the maximum rate (by our own policy, see DEFAULT_TX_SEND_RATE) for several minutes, while not receiving the actual transaction (from any peer) in response to requests for them.

MAX_PEER_TX_REQUEST_IN_FLIGHT

Maximum number of in‐flight transaction requests from a peer. It is not a hard limit, but the threshold at which point the OVERLOADED_PEER_TX_DELAY kicks in.

NONPREF_PEER_TX_DELAY

How long to delay requesting transactions from non‐preferred peers

OVERLOADED_PEER_TX_DELAY

How long to delay requesting transactions from overloaded peers (see MAX_PEER_TX_REQUEST_IN_FLIGHT).

SNAPSHOT_BLOCKHASH_FILENAME

The file in the snapshot chainstate dir which stores the base blockhash. This is needed to reconstruct snapshot chainstates on init.

SNAPSHOT_CHAINSTATE_SUFFIX

Suffix appended to the chainstate (leveldb) dir when created based upon a snapshot.

STORAGE_HEADER_BYTES

Size of header written by WriteBlock before a serialized CBlock (8 bytes)

TXID_RELAY_DELAY

How long to delay requesting transactions via txids, if we have wtxid‐relaying peers

UNDOFILE_CHUNK_SIZE

The pre‐allocation chunk size for rev?????.dat files (since 0.8)

UNDO_DATA_DISK_OVERHEAD

Total overhead when writing undo data: header (8 bytes) plus checksum (32 bytes)

Using Declarations

Name

Description

BlockTreeDB

Bring the kernel block‐tree database type into the node namespace.

CBlockFileInfo

Bring the kernel block‐file info type into the node namespace.

Created with MrDocs