Skip to main content

Module types

Module types 

Source
Expand description

Essential Bitcoin types for consensus validation

Structsยง

Bip54BoundaryTimestamps
BIP54 timewarp: timestamps of boundary blocks for period-boundary checks.
Block
Block: โ„ฌ = โ„‹ ร— ๐’ฏ๐’ณ*
BlockContext
Block validation context
BlockHash
Block hash: newtype wrapper for type safety
BlockHeader
Block Header: โ„‹ = โ„ค ร— โ„ ร— โ„ ร— โ„• ร— โ„• ร— โ„•
BlockHeight
Block height: newtype wrapper for type safety
OutPoint
OutPoint: ๐’ช = โ„ ร— โ„•
ScriptContext
Script execution context
SharedByteString
Shareable script_pubkey for UTXO: small scripts use inline storage; longer use Arc<[u8]>. Clone is cheap (inline copies up to SHARED_BYTE_INLINE_CAP bytes, shared is Arc::clone). Serde matches ByteString.
TimeContext
Time context for consensus validation
Transaction
Transaction: ๐’ฏ๐’ณ = โ„• ร— โ„* ร— ๐’ฏ* ร— โ„•
TransactionInput
Transaction Input: โ„ = ๐’ช ร— ๐•Š ร— โ„•
TransactionOutput
Transaction Output: ๐’ฏ = โ„ค ร— ๐•Š
UTXO
UTXO: ๐’ฐ = โ„ค ร— ๐•Š ร— โ„•

Enumsยง

ForkId
Stable identifier for each consensus-affecting fork (BIP or soft-fork bundle).
Network
Network type for consensus validation
ValidationResult
Validation result

Constantsยง

TX_SLICE_LARGE_MAX
TX_SLICE_LARGE_MIN
Inclusive jemalloc-large window that covers the 768KiB / 1.00 / 1.25 / 1.50 MiB classes.

Staticsยง

ARC_BLOCKHEADER_CREATED
Total Arc heap allocations created (each Arc::new(header) call). Compare to jemalloc bin112 curregs to see how many have been freed.
ARC_BLOCK_CREATED
Total Arc heap allocations created on IBD production paths. Incremented at: download received_put (live + CHUNK_OBSOLETE drain), local_block gap inject. Test dummies do not increment (not in MEM_REPORT).
BLOCK_LIVE
Live Block values created via from_parts / serde / Clone (IBD wire decode
LARGE_TX_SLICE_BYTES
Sum of those large slice heaps (bytes).
LARGE_TX_SLICE_LIVE
Live Box<[Transaction]> whose heap size falls in jemalloc 768KiBโ€“1.5MiB large classes (n_tx * size_of::<Transaction>()). dest-ba 650k bins of 1.00 / 1.25 MiB are this size class (256 B ร— 4096 / 5120 txs).
SBS_SHARED_LIVE
Live count of SharedByteString instances using heap Arc<u8> (script > 25 bytes). Each live Shared variant holds one Arc heap allocation of (16 + script_len) bytes. If this grows unboundedly it means Arc<u8> script refs are being retained somewhere.
SBS_SHARED_TOTAL
Total Shared variants ever created (never decremented).

Functionsยง

tx_slice_heap_bytes
utxo_set_insert
Insert owned UTXO into UtxoSet (wraps in Arc). Convenience for tests and one-off inserts.
utxo_set_with_capacity
Pre-allocate a UtxoSet for n entries. Avoids costly reallocation spikes when loading large checkpoints (at 50M entries the HashMap table alone is ~2.5 GB; a growth-triggered realloc temporarily doubles that).

Type Aliasesยง

ByteString
Byte string type
Hash
Hash type: 256-bit hash
Integer
Integer type
Natural
Natural number type
UtxoSet
Witness
Witness data: stack of witness elements (SegWit/Taproot)