github.com/MetalBlockchain/metalgo@v1.11.9/vms/components/verify/verification.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package verify
     5  
     6  import "github.com/MetalBlockchain/metalgo/snow"
     7  
     8  type Verifiable interface {
     9  	Verify() error
    10  }
    11  
    12  type State interface {
    13  	snow.ContextInitializable
    14  	Verifiable
    15  	IsState
    16  }
    17  
    18  type IsState interface {
    19  	isState()
    20  }
    21  
    22  type IsNotState interface {
    23  	isState() error
    24  }
    25  
    26  // All returns nil if all the verifiables were verified with no errors
    27  func All(verifiables ...Verifiable) error {
    28  	for _, verifiable := range verifiables {
    29  		if err := verifiable.Verify(); err != nil {
    30  			return err
    31  		}
    32  	}
    33  	return nil
    34  }