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

     1  package module
     2  
     3  import "github.com/onflow/flow-go/model/flow"
     4  
     5  // SealValidator checks seals with respect to current protocol state.
     6  // Accepts `candidate` block with seals
     7  // that needs to be verified for protocol state validity.
     8  // Returns the following values:
     9  // * last seal in `candidate` block - in case of success
    10  // * engine.InvalidInputError - in case if `candidate` block violates protocol state.
    11  // * exception in case of any other error, usually this is not expected.
    12  // PREREQUISITE:
    13  // The SealValidator can only process blocks which are attached to the main chain
    14  // (without any missing ancestors). This is the case because:
    15  //   - the Seal validator walks the chain backwards and requires the relevant ancestors to be known and validated
    16  //   - the storage.Seals only holds seals for block that are attached to the main chain.
    17  type SealValidator interface {
    18  	Validate(candidate *flow.Block) (*flow.Seal, error)
    19  }