Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FinalizedBlockProcessor ¶
type FinalizedBlockProcessor struct {
component.Component
// contains filtered or unexported fields
}
FinalizedBlockProcessor processes finalized blocks and builds a collection-to-finalized-block index.
The processor iterates through each finalized block sequentially and indexes which finalized block contains each collection. This index is necessary because while a collection can belong to multiple unfinalized blocks, each collection belongs to exactly one finalized block. This uniqueness property enables efficient transaction result lookups.
The collection-to-block index is used by the GetTransactionResult API to locate the block containing a transaction. The lookup process is: transaction -> collection (via collection sync indexer) -> finalized block (via this indexer). The transaction-to-collection index is built by the collection sync indexer, which indexes either sealed or finalized blocks. When indexing finalized blocks, the transaction-to-collection mapping is also unique.
The processor uses a worker loop that processes blocks sequentially by height, triggered by the distributor when new blocks are finalized. This design enables high-throughput block finalization handling without blocking other system components.
func NewFinalizedBlockProcessor ¶
func NewFinalizedBlockProcessor( log zerolog.Logger, state protocol.State, lockManager storage.LockManager, db storage.DB, blocks storage.Blocks, finalizedProcessedHeight storage.ConsumerProgressInitializer, distributor hotstuff.Distributor, collectionExecutedMetric module.CollectionExecutedMetric, ) (*FinalizedBlockProcessor, error)
NewFinalizedBlockProcessor creates and initializes a new FinalizedBlockProcessor, setting up worker loop infrastructure to handle finalized block processing.
No errors are expected during normal operations.