Skip to main content

Module types

Module types 

Source
Expand description

Essential Bitcoin types for consensus validation

Modules§

smallvec
Small vectors in various sizes. These store a certain number of elements inline, and fall back to the heap for larger allocations. This can be a useful optimization for improving cache locality and reducing allocator traffic for workloads that fit within the inline buffer.

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 64 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

Functions§

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
UTXO Set: 𝒰𝒮 = 𝒪 → 𝒰
Witness
Witness data: stack of witness elements (SegWit/Taproot)