github.com/ari-anchor/sei-tendermint@v0.0.0-20230519144642-dc826b7b56bb/light/provider/provider.go (about)

     1  package provider
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/ari-anchor/sei-tendermint/types"
     7  )
     8  
     9  //go:generate ../../scripts/mockery_generate.sh Provider
    10  
    11  // Provider provides information for the light client to sync (verification
    12  // happens in the client).
    13  type Provider interface {
    14  	// LightBlock returns the LightBlock that corresponds to the given
    15  	// height.
    16  	//
    17  	// 0 - the latest.
    18  	// height must be >= 0.
    19  	//
    20  	// If the provider fails to fetch the LightBlock due to the IO or other
    21  	// issues, an error will be returned.
    22  	// If there's no LightBlock for the given height, ErrLightBlockNotFound
    23  	// error is returned.
    24  	LightBlock(ctx context.Context, height int64) (*types.LightBlock, error)
    25  
    26  	// ReportEvidence reports an evidence of misbehavior.
    27  	ReportEvidence(context.Context, types.Evidence) error
    28  
    29  	// Returns the ID of a provider. For RPC providers it returns the IP address of the client
    30  	// For p2p providers it returns a combination of NodeID and IP address
    31  	ID() string
    32  }