procedure

package
v0.42.4-pebble.4-fix-a... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FinalizeClusterBlock

func FinalizeClusterBlock(lctx lockctx.Proof, rw storage.ReaderBatchWriter, blockID flow.Identifier) error

FinalizeClusterBlock finalizes a block in cluster consensus.

func IndexNewBlock

func IndexNewBlock(lctx lockctx.Proof, rw storage.ReaderBatchWriter, blockID flow.Identifier, parentID flow.Identifier) error

IndexNewBlock will add parent-child index for the new block.

  • Each block has a parent, we use this parent-child relationship to build a reverse index for looking up children blocks for a given block. This is useful for forks recovery where we want to find all the pending children blocks for the lastest finalized block.

When adding parent-child index for a new block, we will update two indexes:

  1. Per protocol convention, blocks must be ingested in "ancestors-first" order. Hence, if a block is new (needs to be verified, to avoid state corruption in case of repeated calls), its set of persisted children is empty at the time of insertion.
  2. Since the parent block has this new block as a child, we add to the parent block's children. There are two special cases for (2): - If the parent block is zero (i.e. genesis block), then we don't need to add this index. - If the parent block doesn't exist, then we will index the new block as the only child of the parent anyway. This is useful for bootstrapping nodes with truncated history.

func IndexNewClusterBlock

func IndexNewClusterBlock(lctx lockctx.Proof, rw storage.ReaderBatchWriter, blockID flow.Identifier, parentID flow.Identifier) error

func InsertClusterBlock

func InsertClusterBlock(lctx lockctx.Proof, rw storage.ReaderBatchWriter, block *cluster.Block) error

InsertClusterBlock inserts a cluster consensus block, updating all associated indexes.

CAUTION:

  • The caller must acquire the lock storage.LockInsertOrFinalizeClusterBlock and hold it until the database write has been committed. This lock allows `InsertClusterBlock` to verify that this block has not yet been indexed. In order to protect against accidental mutation of existing data, this read and subsequent writes must be performed as one atomic operation. Hence, the requirement to hold the lock until the write is committed.

We return storage.ErrAlreadyExists if the block has already been persisted before, i.e. we only insert a block once. This error allows the caller to detect duplicate inserts. No other errors are expected during normal operation.

func InsertClusterPayload

func InsertClusterPayload(lctx lockctx.Proof, rw storage.ReaderBatchWriter, blockID flow.Identifier, payload *cluster.Payload) error

InsertClusterPayload inserts the payload for a cluster block. It inserts both the collection and all constituent transactions, allowing duplicates.

func InsertIndex

func InsertIndex(lctx lockctx.Proof, rw storage.ReaderBatchWriter, blockID flow.Identifier, index *flow.Index) error

func LookupBlockChildren

func LookupBlockChildren(r storage.Reader, blockID flow.Identifier, childrenIDs *flow.IdentifierList) error

LookupBlockChildren looks up the IDs of all child blocks of the given parent block.

func RetrieveClusterBlock

func RetrieveClusterBlock(r storage.Reader, blockID flow.Identifier, block *cluster.Block) error

RetrieveClusterBlock retrieves a cluster consensus block by block ID.

func RetrieveClusterPayload

func RetrieveClusterPayload(r storage.Reader, blockID flow.Identifier, payload *cluster.Payload) error

RetrieveClusterPayload retrieves a cluster consensus block payload by block ID.

func RetrieveIndex

func RetrieveIndex(r storage.Reader, blockID flow.Identifier, index *flow.Index) error

func RetrieveLatestFinalizedClusterHeader

func RetrieveLatestFinalizedClusterHeader(r storage.Reader, clusterID flow.ChainID, final *flow.Header) error

RetrieveLatestFinalizedClusterHeader retrieves the latest finalized cluster block header from the specified cluster.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL