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