github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/finalizer.go (about)

     1  package module
     2  
     3  import (
     4  	"github.com/onflow/flow-go/model/flow"
     5  )
     6  
     7  // Finalizer is used by the consensus algorithm to inform other components for (such
     8  // as the protocol state) about finalization of blocks.
     9  //
    10  // Since we have two different protocol states: one for the main consensus,
    11  // the other for the collection cluster consensus, the Finalizer interface
    12  // allows the two different protocol states to provide different implementations
    13  // for updating its state when a block has been finalized.
    14  //
    15  // Updating the protocol state should always succeed when the data is consistent.
    16  // However, in case the protocol state is corrupted, error should be returned and
    17  // the consensus algorithm should halt. So the error returned from MakeFinal is
    18  // for the protocol state to report exceptions.
    19  type Finalizer interface {
    20  
    21  	// MakeFinal will declare a block and all of its ancestors as finalized, which
    22  	// makes it an immutable part of the blockchain. Returning an error indicates
    23  	// some fatal condition and will cause the finalization logic to terminate.
    24  	MakeFinal(blockID flow.Identifier) error
    25  }